<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>Matrix207&#39;s Blog</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta property="og:type" content="website">
<meta property="og:title" content="Matrix207's Blog">
<meta property="og:url" content="http://yoursite.com/page/5/index.html">
<meta property="og:site_name" content="Matrix207's Blog">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Matrix207's Blog">
  
    <link rel="alternate" href="/atom.xml" title="Matrix207&#39;s Blog" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
  

</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Matrix207&#39;s Blog</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="Flux RSS"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Rechercher"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main">
  
    <article id="post-nfs" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2015/03/25/nfs/" class="article-date">
  <time datetime="2015-03-24T16:00:00.000Z" itemprop="datePublished">2015-03-25</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/storage/">storage</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2015/03/25/nfs/">nfs</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="About-NFS"><a href="#About-NFS" class="headerlink" title="About NFS"></a>About NFS</h3><p>NFS is “Network File System”.</p>
<ul>
<li>linux find NFS version, using command <code>nfsstat -m</code> on client machine, 找到字符串”vers=4.0”<ul>
<li><a href="http://network.51cto.com/art/201008/216664.htm" target="_blank" rel="external">对比分析各个NFS版本的特点</a></li>
</ul>
</li>
</ul>
<h3 id="How-to-use"><a href="#How-to-use" class="headerlink" title="How to use"></a>How to use</h3><ul>
<li><p>On server:</p>
<ul>
<li>service nfs start|stop</li>
<li>set ACL (Access Control Lists) of files and directories.<ul>
<li>setfacl -m other::— PATH</li>
<li>setfacl -m g:GROUP_NAME:rwx PATH</li>
<li>setfacl -m g:GROUP_NAME:— PATH</li>
</ul>
</li>
</ul>
</li>
<li><p>On clinet: mount nfs share disk</p>
<ul>
<li>showmount -e 172.16.130.143</li>
<li>mkdir /mnt/nfs</li>
<li>mount 172.16.130.143:/share/vdshare001 /mnt/nfs</li>
<li>ls /mnt/nfs</li>
<li>umount /mnt/nfs</li>
</ul>
</li>
<li><p>command operation:  </p>
<p>  [root@Ustor ~]# service nfs start<br>  Starting RPC svcgssd:                                      [  OK  ]<br>  Starting NFS services:                                     [  OK  ]<br>  Starting NFS quotas:                                       [  OK  ]<br>  Starting NFS mountd:                                       [  OK  ]<br>  Stopping RPC idmapd:                                       [  OK  ]<br>  Starting RPC idmapd:                                       [  OK  ]<br>  Starting NFS daemon:                                       [  OK  ]<br>  [root@Ustor ~]# service nfs status<br>  rpc.svcgssd (pid 11647) is running…<br>  rpc.mountd (pid 11657) is running…<br>  nfsd (pid 11722 11721 11720 11719 11718 11717 11716 11715) is running…<br>  rpc.rquotad (pid 11653) is running..<br>  [root@Ustor ~]# ps aux |grep nfs<br>  root   11713  0.0  0.0      0     0 ?      S    23:34   0:00 [nfsd4]<br>  root   11714  0.0  0.0      0     0 ?      S    23:34   0:00 [nfsd4_callbacks]<br>  root   11715  0.0  0.0      0     0 ?      S    23:34   0:00 [nfsd]<br>  root   11716  0.0  0.0      0     0 ?      S    23:34   0:00 [nfsd]<br>  root   11717  0.0  0.0      0     0 ?      S    23:34   0:00 [nfsd]<br>  root   11718  0.0  0.0      0     0 ?      S    23:34   0:00 [nfsd]<br>  root   11719  0.0  0.0      0     0 ?      S    23:34   0:00 [nfsd]<br>  root   11720  0.0  0.0      0     0 ?      S    23:34   0:00 [nfsd]<br>  root   11721  0.0  0.0      0     0 ?      S    23:34   0:00 [nfsd]<br>  root   11722  0.0  0.0      0     0 ?      S    23:34   0:00 [nfsd]<br>  root   11904  0.0  0.0 103240   844 pts/1  S+   23:35   0:00 grep nfs<br>  [root@Ustor ~]# netstat -apn |grep 2049<br>  tcp     0      0 0.0.0.0:2049         0.0.0.0:<em>            LISTEN      -<br>  tcp     0      0 :::2049              :::</em>                 LISTEN      -<br>  udp     0      0 0.0.0.0:2049         0.0.0.0:<em>                        -<br>  udp     0      0 :::2049              :::</em>                             -<br>  [root@Ustor ~]# service nfs stop<br>  Shutting down NFS daemon:                                  [  OK  ]<br>  Shutting down NFS mountd:                                  [  OK  ]<br>  Shutting down NFS quotas:                                  [  OK  ]<br>  Shutting down RPC svcgssd:                                 [  OK  ]</p>
</li>
<li><p>check status from /proc/fs/nfs and /proc/fs/nfsd/</p>
</li>
</ul>
<h3 id="Optimal"><a href="#Optimal" class="headerlink" title="Optimal"></a>Optimal</h3><ul>
<li><p>★★★ <strong><a href="http://blog.csdn.net/yangzhongxuan/article/details/7918884" target="_blank" rel="external">nfs的传输速度优化</a></strong></p>
<ul>
<li>设置块大小 <ul>
<li>time dd if=/dev/zero of=/testfs/testfile bs=8k count=1024 测试nfs写</li>
<li>time dd if=/testfs/testfile of=/dev/null bs=8k 测试nfs读</li>
</ul>
</li>
<li>网络传输包的大小<ul>
<li>ping -s 2048 -f hostname, try different package size</li>
<li>nfsstat －o net</li>
<li>tracepath node1/端口号</li>
<li>ifconfig eth0</li>
<li>ifconfig eth0 mtu 16436, modify MTU value</li>
<li>/proc/sys/net/ipv4/ipfrag_high_thresh和/proc/sys/net/ipv4/ipfrag_low_thresh</li>
</ul>
</li>
<li>nfs挂载的优化<ul>
<li>timeo:如果超时，客户端等待的时间，以十分之一秒计算。</li>
<li>retrans：超时尝试的次数。</li>
<li>bg：后台挂载，很有用</li>
<li>hard：如果server端没有响应，那么客户端一直尝试挂载。</li>
<li>wsize：写块大小</li>
<li>rsize：读块大小</li>
<li>intr：可以中断不成功的挂载</li>
<li>noatime：不更新文件的inode访问时间，可以提高速度。</li>
<li>async：异步读写。</li>
</ul>
</li>
<li>nfsd的个数<ul>
<li>ps -efl |grep nfsd</li>
<li>vi /etc/init.d/nfs, modify RPCNFSDCOUNT </li>
<li>service nfs restart</li>
</ul>
</li>
<li>nfsd的队列长度<ul>
<li>/proc/sys/net/core/rmem_default</li>
<li>/proc/sys/net/core/rmem_max</li>
<li>/proc/sys/net/core/wmem_default</li>
<li>/proc/sys/net/core/wmem_max</li>
<li>vi /etc/sysctl.conf</li>
</ul>
</li>
<li>mount 192.168.1.220:/mnt/nfs /mnt/nfs_t -o nolock, rsize=1024,wsize=1024,timeo=15</li>
</ul>
</li>
<li><p><strong>Linux NFS服务性能优化</strong></p>
<ul>
<li>nfsstat -rc</li>
<li><a href="http://blog.chinaunix.net/uid-24404943-id-3389539.html" target="_blank" rel="external">http://blog.chinaunix.net/uid-24404943-id-3389539.html</a></li>
<li>NFS的队列大小, modify server and client machine: (262144 = 256KB)<br>#echo 262144 &gt; /proc/sys/net/core/rmem_default<br>#echo 262144 &gt; /proc/sys/net/core/rmem_max<br>#echo 262144 &gt; /proc/sys/net/core/wmmen_default<br>#echo 262144 &gt; /proc/sys/net/core/wmmen_max  </li>
<li>[root@localhost iperf-2.0.5]# dd if=/dev/zero of=/tmp/test01.dat bs=1M count=10240<br>10240+0 records in<br>10240+0 records out<br>10737418240 bytes (11 GB) copied, 28.2585 s, 380 MB/s  </li>
<li>ping -s 2048 -f 192.16.110.80</li>
<li><a href="http://www.cnblogs.com/derekchen/archive/2013/01/17/2865207.html" target="_blank" rel="external">http://www.cnblogs.com/derekchen/archive/2013/01/17/2865207.html</a></li>
<li><a href="http://www.lichaozheng.info/2011/10/13/nfs性能优化/" target="_blank" rel="external">http://www.lichaozheng.info/2011/10/13/nfs性能优化/</a></li>
<li><a href="http://blog.csdn.net/anghlq/article/details/8532312" target="_blank" rel="external">http://blog.csdn.net/anghlq/article/details/8532312</a></li>
<li>tracepath 192.16.110.80</li>
<li>[root@localhost iperf-2.0.5]# echo “4096” &gt;/sys/class/net/enp10s0f0/mtu</li>
<li>[root@localhost iperf-2.0.5]# dd if=/dev/zero of=/tmp/test04.dat bs=1M count=10240<br>10737418240 bytes (11 GB) copied, 28.0778 s, 382 MB/s  </li>
</ul>
</li>
</ul>
<ul>
<li><p>NFS共享在使用前需要挂载（mount）。挂载时使用的参数很大程度上影响了读写的性能</p>
<ul>
<li><ol>
<li>TCP or UDP</li>
</ol>
</li>
<li><ol>
<li>rsize和wsize，每次读写的最大值</li>
</ol>
</li>
<li><ol>
<li>sync和async. sync参数会强制wsize变成4KB，这会大大降低写性能。 </li>
</ol>
</li>
</ul>
</li>
<li><p><strong>关于SAMBA和NFS是否支持断点续传</strong></p>
<ul>
<li>经过测试，得出如下结论：<ul>
<li>1.samba 不支持</li>
<li>2.nfs     支持</li>
</ul>
</li>
<li>测试环境和步骤如下：</li>
<li>服务端：<ul>
<li>1.172.16.130.200， Centos7.0</li>
</ul>
</li>
<li>Windows 客户端:<ul>
<li>1.yujl本地机器</li>
<li>2.开始-&gt;运行-&gt;\172.16.130.200</li>
<li>3.拷贝一个大的iso文件到xuni文件夹</li>
<li>4.去机房拔掉172.16.130.200机器的网线</li>
<li>5.发现本地的拷贝窗口停止传送数据</li>
<li>6.接上网线，拷贝窗口仍然没有继续传送的迹象</li>
</ul>
</li>
<li>Linux 客户端:<ul>
<li>1.我本地机器</li>
<li>2.挂载172.16.130.200的/share/sambatest目录到本地的/mnt/nfs</li>
<li>3.cp ~/Downloads/iso/CentOS-6.5-x86_64-bin-DVD1.iso /mnt/nfs/</li>
<li>4.去机房拔掉172.16.130.200机器的网线</li>
<li>5.确认本地无法连接172.16.130.200</li>
<li>6.接上网线，使用ls -l /mnt/nfs/发现iso文件的大小还继续增加</li>
<li>7.待cp完成后，md5sume计算两个iso文件，发现md5值一</li>
</ul>
</li>
<li>不支持，<a href="http://bbs.chinaunix.net/thread-4057603-1-1.html" target="_blank" rel="external">http://bbs.chinaunix.net/thread-4057603-1-1.html</a></li>
<li><a href="http://bbs.chinaunix.net/thread-4057603-1-1.html" target="_blank" rel="external">http://bbs.chinaunix.net/thread-4057603-1-1.html</a></li>
</ul>
</li>
</ul>
<h3 id="Code-analysed-kernel-version-linux-2-6-32-279-el6"><a href="#Code-analysed-kernel-version-linux-2-6-32-279-el6" class="headerlink" title="Code analysed(kernel version: linux-2.6.32-279.el6)"></a>Code analysed(kernel version: linux-2.6.32-279.el6)</h3><ul>
<li><p>NFS 文件系统主要分为三个部分：The Protocol（网络协议），Client Side（NFS 客户端）和 Server Side（NFS 服务器）</p>
<ul>
<li>NFS 客户端提供了接口，保证用户或者应用程序能像访问本地文件系统一样访问NFS 文件系统，</li>
<li>NFS 服务器作为数据源，为 NFS 客户端提供真实的文件系统服务</li>
<li>NFS 网络协议则使得 NFS 客户端和 NFS 服务器能够高效和可靠地进行通信</li>
<li>NFS 网络协议使用的是 RPC（Remote Procedure Call，远程过程调用）/XDR（External Data Representation，外部数据表示）机制</li>
</ul>
</li>
<li><p>code file list: </p>
<p>  [dennis@localhost fs]$ pwd<br>  /home/dennis/work/kernel/linux-2.6.32-279.el6/fs<br>  [dennis@localhost fs]$ ls nfs<br>  cache_lib.c      file.c           nfs2xdr.c            nfsroot.c<br>  cache_lib.h      fscache.c        nfs3acl.c            pagelist.c<br>  callback.c       fscache.h        nfs3proc.c           pnfs.c<br>  callback.h       fscache-index.c  nfs3xdr.c            pnfs_dev.c<br>  callback_proc.c  getroot.c        nfs4filelayout.c     pnfs.h<br>  callback_xdr.c   idmap.c          nfs4filelayoutdev.c  proc.c<br>  client.c         inode.c          nfs4filelayout.h     read.c<br>  delegation.c     internal.h       nfs4_fs.h            super.c<br>  delegation.h     iostat.h         nfs4namespace.c      symlink.c<br>  dir.c            Kconfig          nfs4proc.c           sysctl.c<br>  direct.c         Makefile         nfs4renewd.c         unlink.c<br>  dns_resolve.c    mount_clnt.c     nfs4state.c          write.c<br>  dns_resolve.h    namespace.c      nfs4xdr.c<br>  [dennis@localhost fs]$ ls nfsd<br>  auth.c    Makefile    nfs4callback.c  nfscache.c  nfssvc.c  xdr3.h<br>  auth.h    nfs2acl.c   nfs4idmap.c     nfsctl.c    nfsxdr.c  xdr4.h<br>  cache.h   nfs3acl.c   nfs4proc.c      nfsd.h      state.h   xdr.h<br>  export.c  nfs3proc.c  nfs4recover.c   nfsfh.c     stats.c<br>  Kconfig   nfs3xdr.c   nfs4state.c     nfsfh.h     vfs.c<br>  lockd.c   nfs4acl.c   nfs4xdr.c       nfsproc.c   vfs.h<br>  [dennis@localhost fs]$ ls nfs_common<br>  Makefile  nfsacl.c<br>  [dennis@localhost fs]$ cd ../include/linux/<br>  [dennis@localhost linux]$ ls nfs*<br>  nfs2.h      nfs4.h        nfsd_idmap.h  nfs_fs_sb.h  nfs_iostat.h  nfs_xdr.h<br>  nfs3.h      nfs4_mount.h  nfs_fs.h      nfs.h        nfs_mount.h<br>  nfs4_acl.h  nfsacl.h      nfs_fs_i.h    nfs_idmap.h  nfs_page.h</p>
<p>  nfsd:<br>  const.h  debug.h  export.h  Kbuild  nfsfh.h  stats.h  syscall.h</p>
</li>
<li><p>Client Side 源代码  </p>
<p>Client Side 的头文件在 include/linux/ 下面，C 文件在 fs/nfs 下面。</p>
<p>  dir.c/file.c/inode.c/symlink.c/unlink.c：与文件操作相关的系统调用<br>  read.c/write.c/flushd.c：文件读写<br>  mount_clnt.c/nfs_root.c：将 NFS 文件系统作为 root 目录的相关实现<br>  proc.c/nfs2xdr.c/nfs3proc.c/nfs3xdr.c：网络数据交换 </p>
</li>
</ul>
<p>与文件操作相关的系统调用都在 struct file_operations，struct inode_operations<br>这两个数据结构里面定义。文件的读操作 nfs_file_read 和写操作 nfs_file_write 被单<br>独提出来，因为文件读写性能将直接关系到文件系统的成败</p>
<ul>
<li>Server Side 源代码</li>
</ul>
<p>Server Side 的头文件在 include/linux/nfsd 下面，C 文件在 fs/nfsd 下面。</p>
<pre><code>auth.c/lockd.c/export.c/nfsctl.c/nfscache.c/nfsfh.c/stats.c：导出目录的访问管理
nfssvc.c：NFS 服务 deamon 的实现
vfs.c：将 NFS 文件系统的操作转换成具体文件系统的操作
nfsproc.c/nfsxdr.c/nfs3proc.c/nfs3xdr.c：网络数据交换
</code></pre><p>导出目录的访问管理主要解决网络文件系统实现面临的几个重要问题，包括目录导出服务，<br>外部访问的权限控制，多客户端以及客户端与服务器的文件并发操作等。 </p>
<ul>
<li><p>process number of nfsd:  </p>
</li>
<li><p>rename call stack:  </p>
<p>  client: nfs_rename -&gt;<br>  server: nfsd4_rename -&gt; nfsd_rename </p>
</li>
<li><p><strong>To be continue…</strong></p>
</li>
</ul>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><strong><a href="http://www.ibm.com/developerworks/cn/linux/l-cn-nfs/" target="_blank" rel="external">NFS文件系统源代码剖析</a></strong></li>
<li><a href="http://zohead.com/archives/nfs-rwsize/" target="_blank" rel="external">NFS读写块大小问题分析</a></li>
<li><a href="http://www.lichaozheng.info/2011/10/13/nfs性能优化/" target="_blank" rel="external">NFS性能优化手册</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2015/03/25/nfs/" data-id="ciqqpe1sn00c8nmpv9axa8ofn" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/file-system/">file system</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-how-to-detect-the-internal-network-topology-of-company" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2015/03/12/how-to-detect-the-internal-network-topology-of-company/" class="article-date">
  <time datetime="2015-03-11T16:00:00.000Z" itemprop="datePublished">2015-03-12</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/network/">network</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2015/03/12/how-to-detect-the-internal-network-topology-of-company/">how to detect the internal network topology of company</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="What-I-want"><a href="#What-I-want" class="headerlink" title="What I want"></a>What I want</h3><p>How can know how many route/hub/switch are in my LAN network?</p>
<h3 id="What-I-know"><a href="#What-I-know" class="headerlink" title="What I know"></a>What I know</h3><ul>
<li>Host LAN IP is : 172.16.50.39</li>
<li>gateway is : 172.16.50.1</li>
<li>WLan IP: 219.134.89.155</li>
</ul>
<h3 id="Operations"><a href="#Operations" class="headerlink" title="Operations"></a>Operations</h3><pre><code>[dennis@localhost ~]$ ip addr
1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp2s0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:23:ae:96:d6:9a brd ff:ff:ff:ff:ff:ff
    inet 172.16.50.39/24 brd 172.16.50.255 scope global enp2s0
       valid_lft forever preferred_lft forever
    inet6 fe80::223:aeff:fe96:d69a/64 scope link 
       valid_lft forever preferred_lft forever
[dennis@localhost ~]$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
^C
[dennis@localhost ~]$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.16.50.1     0.0.0.0         UG    1024   0        0 enp2s0
172.16.50.0     0.0.0.0         255.255.255.0   U     0      0        0 enp2s0
[dennis@localhost ~]$ curl ifconfig.me
219.134.89.155
[dennis@localhost ~]$ ping www.baidu.com
PING www.a.shifen.com (180.97.33.108) 56(84) bytes of data.
64 bytes from 180.97.33.108: icmp_seq=1 ttl=51 time=36.6 ms
64 bytes from 180.97.33.108: icmp_seq=2 ttl=51 time=42.0 ms
...
^C
--- www.a.shifen.com ping statistics ---
120 packets transmitted, 120 received, 0% packet loss, time 138219ms
rtt min/avg/max/mdev = 28.061/41.513/82.900/10.308 ms
[dennis@localhost ~]$ traceroute www.baidu.com
traceroute to www.baidu.com (180.97.33.107), 30 hops max, 60 byte packets
 1  172.16.50.1 (172.16.50.1)  3.386 ms  3.431 ms  3.463 ms
 2  219.134.89.153 (219.134.89.153)  6.355 ms  7.169 ms  7.155 ms
 3  10.1.100.37 (10.1.100.37)  5.989 ms  6.274 ms  6.318 ms
 4  121.15.130.18 (121.15.130.18)  7.180 ms  7.167 ms  7.153 ms
 5  61.104.38.59.broad.fs.gd.dynamic.163data.com.cn (59.38.104.61)  6.227 ms  6.219 ms 57.104.38.59.broad.fs.gd.dynamic.163data.com.cn (59.38.104.57)  6.924 ms
 6  183.56.65.30 (183.56.65.30)  31.614 ms 183.56.66.2 (183.56.66.2)  13.175 ms 183.56.65.38 (183.56.65.38)  12.152 ms
 7  202.97.64.73 (202.97.64.73)  37.557 ms  37.543 ms  38.302 ms
 8  202.102.69.114 (202.102.69.114)  42.036 ms  43.259 ms  43.246 ms
 9  * * *
10  180.97.32.2 (180.97.32.2)  37.346 ms 180.97.32.6 (180.97.32.6)  38.140 ms 180.97.32.22 (180.97.32.22)  36.722 ms
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *
[dennis@localhost ~]$ traceroute 219.134.89.155
traceroute to 219.134.89.155 (219.134.89.155), 30 hops max, 60 byte packets
 1  172.16.50.1 (172.16.50.1)  3.835 ms  3.856 ms  3.885 ms
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *
</code></pre>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2015/03/12/how-to-detect-the-internal-network-topology-of-company/" data-id="ciqqpe1sj00c5nmpviqrmcidt" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/network/">network</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-understand-linux-route" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2015/03/11/understand-linux-route/" class="article-date">
  <time datetime="2015-03-10T16:00:00.000Z" itemprop="datePublished">2015-03-11</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/linux/">linux</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2015/03/11/understand-linux-route/">understand linux route</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="路由规则理解"><a href="#路由规则理解" class="headerlink" title="路由规则理解"></a>路由规则理解</h3><p>主机的网络封包需要会根据路由规则来判断如何将封包发送出去</p>
<p>路由是雙向的，你必須要瞭解出去的路由與回來時的規則</p>
<h3 id="常用命令"><a href="#常用命令" class="headerlink" title="常用命令"></a>常用命令</h3><ul>
<li><code>route</code><br><code>route -n</code><br><code>route add default gw 172.16.130.1 eth2</code><br><code>route del default gw 172.16.130.1 eth2</code><br><code>route add -host 192.168.168.110 dev eth0</code><br><code>route del -host 192.168.168.110 dev eth0</code><br><code>route add -net 172.16.130.0/24 gw 172.16.130.1 eth2</code><br><code>route del -net 172.16.0.0 netmask 255.255.0.0 dev eth0</code><br><code>ip route flush cache</code>  </li>
<li><code>sysctl -a |grep forward</code></li>
<li><code>sysctl -a |grep ignore</code></li>
<li><code>echo 2 &gt; /proc/sys/net/ipv4/conf/default/rp_filter</code></li>
<li><code>echo 2 &gt; /proc/sys/net/ipv4/conf/all/rp_filter</code></li>
<li><code>sysctl -p</code></li>
<li><code>vim /etc/sysctl.conf</code></li>
<li><code>traceroute www.baidu.com</code></li>
</ul>
<h3 id="相关配置文件"><a href="#相关配置文件" class="headerlink" title="相关配置文件"></a>相关配置文件</h3><pre><code>[root@localhost ~]# cat /etc/iproute2/rt_tables
#
# reserved values
#
255    local
254    main
253    default
0    unspec
#
# local
#
#1    inr.ruhep
[root@localhost ~]# sysctl -a |grep ignore
net.ipv4.conf.all.arp_ignore = 0
net.ipv4.conf.default.arp_ignore = 0
net.ipv4.conf.lo.arp_ignore = 0
net.ipv4.conf.eth0.arp_ignore = 0
net.ipv4.conf.eth1.arp_ignore = 0
net.ipv4.icmp_echo_ignore_all = 0
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1
[root@localhost ~]# cat /etc/sysctl.conf 
</code></pre><h3 id="例子"><a href="#例子" class="headerlink" title="例子"></a>例子</h3><p>如果是双网卡且设定的是同一网段IP:   </p>
<ul>
<li>eth0 : 192.168.0.100</li>
<li>eth1 : 192.168.0.200</li>
</ul>
<p>那么一般会生成这样的路由规则:  </p>
<pre><code>[root@www ~]# route -n
Kernel IP routing table
Destination     Gateway   Genmask         Flags Metric Ref   Use Iface
192.168.0.0     0.0.0.0   255.255.255.0   U     0      0       0 eth1
192.168.0.0     0.0.0.0   255.255.255.0   U     0      0       0 eth0
</code></pre><p>也就是說:  </p>
<ul>
<li>當要主動發送封包到192.168.0.0/24的網域時，都只會透過第一條規則，也就是透過eth1來傳出去!</li>
<li>在回應封包方面，不管是由eth0還是由eth1進來的網路封包，都會透過 eth1 來回傳!</li>
</ul>
<p>来自: <a href="http://linux.vbird.org/linux_server/0230router.php" target="_blank" rel="external">http://linux.vbird.org/linux_server/0230router.php</a>, [8.1.3 重複路由的問題] </p>
<h3 id="只设置一个网口IP"><a href="#只设置一个网口IP" class="headerlink" title="只设置一个网口IP"></a>只设置一个网口IP</h3><pre><code>[dennis@localhost ~]$ ssh root@172.16.60.53
root@172.16.60.53&apos;s password: 
Last login: Wed Mar 11 17:54:12 2015 from 172.16.50.39
[root@localhost ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16.60.0     *               255.255.255.0   U     0      0        0 eth2
default         172.16.60.1     0.0.0.0         UG    0      0        0 eth2
[root@localhost ~]# ip addr
1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc mq state DOWN qlen 1000
    link/ether a0:36:9f:32:b0:d0 brd ff:ff:ff:ff:ff:ff
3: eth1: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc mq state DOWN qlen 1000
    link/ether a0:36:9f:32:b0:d1 brd ff:ff:ff:ff:ff:ff
4: eth2: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:25:90:f4:6b:60 brd ff:ff:ff:ff:ff:ff
    inet 172.16.60.53/24 brd 172.16.60.255 scope global eth2
    inet6 fe80::225:90ff:fef4:6b60/64 scope link 
       valid_lft forever preferred_lft forever
5: eth3: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:25:90:f4:6b:61 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::225:90ff:fef4:6b61/64 scope link 
       valid_lft forever preferred_lft forever
</code></pre><h3 id="没有问题的设定"><a href="#没有问题的设定" class="headerlink" title="没有问题的设定"></a>没有问题的设定</h3><pre><code>[dennis@localhost ~]$ ssh root@172.16.130.105
root@172.16.130.105&apos;s password: 
Permission denied, please try again.
root@172.16.130.105&apos;s password: 
Last login: Wed Mar 11 16:34:38 2015 from 172.16.50.39
[root@localhost ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16.130.0    *               255.255.255.0   U     0      0        0 eth0
172.16.130.0    *               255.255.255.0   U     0      0        0 eth1
default         172.16.130.1    0.0.0.0         UG    0      0        0 eth1
default         172.16.130.1    0.0.0.0         UG    0      0        0 eth0
[root@localhost ~]# ping 172.16.50.39 -I eth1
PING 172.16.50.39 (172.16.50.39) from 172.16.130.106 eth1: 56(84) bytes of data.
64 bytes from 172.16.50.39: icmp_seq=1 ttl=63 time=11.7 ms
64 bytes from 172.16.50.39: icmp_seq=2 ttl=63 time=0.265 ms
^C
--- 172.16.50.39 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1568ms
rtt min/avg/max/mdev = 0.265/6.030/11.795/5.765 ms
[root@localhost ~]# ping 172.16.50.39 -I eth0
PING 172.16.50.39 (172.16.50.39) from 172.16.130.105 eth0: 56(84) bytes of data.
64 bytes from 172.16.50.39: icmp_seq=1 ttl=63 time=0.244 ms
64 bytes from 172.16.50.39: icmp_seq=2 ttl=63 time=6.12 ms
64 bytes from 172.16.50.39: icmp_seq=3 ttl=63 time=6.50 ms
^C
--- 172.16.50.39 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2414ms
rtt min/avg/max/mdev = 0.244/4.290/6.504/2.866 ms
[root@localhost ~]# ip addr
1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth1: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:25:90:de:fc:13 brd ff:ff:ff:ff:ff:ff
    inet 172.16.130.106/24 scope global eth1
    inet6 fe80::225:90ff:fede:fc13/64 scope link 
       valid_lft forever preferred_lft forever
3: eth0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:25:90:de:fc:12 brd ff:ff:ff:ff:ff:ff
    inet 172.16.130.105/24 scope global eth0
    inet6 fe80::225:90ff:fede:fc12/64 scope link 
       valid_lft forever preferred_lft forever
[root@localhost ~]# ip route show
172.16.130.0/24 dev eth0  proto kernel  scope link  src 172.16.130.105 
172.16.130.0/24 dev eth1  proto kernel  scope link  src 172.16.130.106 
default via 172.16.130.1 dev eth1 
default via 172.16.130.1 dev eth0 
</code></pre><h3 id="一台奇怪问题的机器"><a href="#一台奇怪问题的机器" class="headerlink" title="一台奇怪问题的机器"></a>一台奇怪问题的机器</h3><p>问题机器: 双网卡，IP信息 eth0:172.16.60.150 eth1:172.16.60.151 网关172.16.60.1  </p>
<p>本地主机: IP 172.16.50.39, 网关:172.16.50.1</p>
<p>本地(50.39)可以正常ssh登陆60.150  </p>
<p>但ping 172.16.60.151没有回应:</p>
<pre><code>[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:1e:67:c9:9a:f4
TYPE=Ethernet
UUID=5adb47dc-d361-43b7-a23a-f17c2ade1e2d
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=172.16.60.150
NETMASK=255.255.255.0
GATEWAY=172.16.60.1
IPV6INIT=no
USERCTL=no
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
HWADDR=00:1e:67:c9:9a:f5
TYPE=Ethernet
UUID=2af28c1e-abe2-4805-8c78-880ffbfc567e
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPV6INIT=no
USERCTL=no
IPADDR=172.16.60.151
NETMASK=255.255.255.0
GATEWAY=172.16.60.1
[root@localhost ~]# ip addr  
1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 16436 qdisc noqueue state UNKNOWN   
  link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00  
  inet 127.0.0.1/8 scope host lo  
  inet6 ::1/128 scope host   
     valid_lft forever preferred_lft forever  
2: eth0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc mq state UP qlen 1000  
  link/ether 00:1e:67:c9:9a:f4 brd ff:ff:ff:ff:ff:ff  
  inet 172.16.60.150/24 brd 172.16.60.255 scope global eth0  
  inet6 fe80::21e:67ff:fec9:9af4/64 scope link   
     valid_lft forever preferred_lft forever  
3: eth1: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc mq state UP qlen 1000  
  link/ether 00:1e:67:c9:9a:f5 brd ff:ff:ff:ff:ff:ff  
  inet 172.16.60.151/24 brd 172.16.60.255 scope global eth1  
  inet6 fe80::21e:67ff:fec9:9af5/64 scope link   
     valid_lft forever preferred_lft forever  
[root@localhost ~]# route  
Kernel IP routing table  
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface  
172.16.60.0     *               255.255.255.0   U     0      0        0 eth0  
172.16.60.0     *               255.255.255.0   U     0      0        0 eth1  
link-local      *               255.255.0.0     U     1002   0        0 eth0  
link-local      *               255.255.0.0     U     1003   0        0 eth1  
default         172.16.60.1     0.0.0.0         UG    0      0        0 eth0  
</code></pre><p>通过同一网段的机器(172.16.60.53)，ping 151得到的是Destination Host Unreachable  </p>
<pre><code>[dennis@localhost ~]$ ssh root@172.16.60.53
The authenticity of host &apos;172.16.60.53 (172.16.60.53)&apos; can&apos;t be established.
RSA key fingerprint is e6:b0:c1:60:53:cd:77:7c:32:e4:27:4f:01:43:5a:8a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added &apos;172.16.60.53&apos; (RSA) to the list of known hosts.
root@172.16.60.53&apos;s password: 
Last login: Fri Dec  6 04:46:04 2013
[root@localhost ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16.60.0     *               255.255.255.0   U     0      0        0 eth2
default         172.16.60.1     0.0.0.0         UG    0      0        0 eth2
[root@localhost ~]# ping 172.16.60.151
PING 172.16.60.151 (172.16.60.151) 56(84) bytes of data.
From 172.16.60.53 icmp_seq=2 Destination Host Unreachable
From 172.16.60.53 icmp_seq=3 Destination Host Unreachable
From 172.16.60.53 icmp_seq=4 Destination Host Unreachable
^C
--- 172.16.60.151 ping statistics ---
5 packets transmitted, 0 received, +3 errors, 100% packet loss, time 4988ms
pipe 3
[root@localhost ~]# ping 172.16.60.150
PING 172.16.60.150 (172.16.60.150) 56(84) bytes of data.
64 bytes from 172.16.60.150: icmp_seq=1 ttl=64 time=0.933 ms
64 bytes from 172.16.60.150: icmp_seq=2 ttl=64 time=0.235 ms
64 bytes from 172.16.60.150: icmp_seq=3 ttl=64 time=0.223 ms
^C
--- 172.16.60.150 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2045ms
rtt min/avg/max/mdev = 0.223/0.463/0.933/0.332 ms
[root@localhost ~]# 
</code></pre><p>且从eth1(60.151)ping不通网关(172.16.60.1), ping同网段另外一台机器(60.53)开始会停顿:   </p>
<pre><code>[root@localhost ~]# arp
Address                  HWtype  HWaddress           Flags Mask            Iface
172.16.60.1              ether   00:0f:e2:b1:c7:5d   C                     eth0
[root@localhost ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16.60.0     *               255.255.255.0   U     0      0        0 eth0
172.16.60.0     *               255.255.255.0   U     0      0        0 eth1
link-local      *               255.255.0.0     U     1002   0        0 eth0
default         172.16.60.1     0.0.0.0         UG    0      0        0 eth0
[root@localhost ~]# ping 172.16.60.53 -I eth1
PING 172.16.60.53 (172.16.60.53) from 172.16.60.151 eth1: 56(84) bytes of data.
64 bytes from 172.16.60.53: icmp_seq=10 ttl=64 time=1.08 ms
64 bytes from 172.16.60.53: icmp_seq=11 ttl=64 time=0.228 ms
64 bytes from 172.16.60.53: icmp_seq=12 ttl=64 time=0.230 ms
64 bytes from 172.16.60.53: icmp_seq=13 ttl=64 time=0.226 ms
64 bytes from 172.16.60.53: icmp_seq=14 ttl=64 time=0.238 ms
64 bytes from 172.16.60.53: icmp_seq=15 ttl=64 time=0.225 ms
64 bytes from 172.16.60.53: icmp_seq=16 ttl=64 time=0.227 ms
^C
--- 172.16.60.53 ping statistics ---
16 packets transmitted, 7 received, 56% packet loss, time 15646ms
rtt min/avg/max/mdev = 0.225/0.351/1.085/0.299 ms
[root@localhost ~]# ping 172.16.50.39 -I eth1
PING 172.16.50.39 (172.16.50.39) from 172.16.60.151 eth1: 56(84) bytes of data.
From 172.16.60.151 icmp_seq=2 Destination Host Unreachable
From 172.16.60.151 icmp_seq=3 Destination Host Unreachable
From 172.16.60.151 icmp_seq=4 Destination Host Unreachable
From 172.16.60.151 icmp_seq=6 Destination Host Unreachable
From 172.16.60.151 icmp_seq=7 Destination Host Unreachable
From 172.16.60.151 icmp_seq=8 Destination Host Unreachable
^C
--- 172.16.50.39 ping statistics ---
8 packets transmitted, 0 received, +6 errors, 100% packet loss, time 7646ms
pipe 3
[root@localhost ~]# ping 172.16.60.1 -I eth1
PING 172.16.60.1 (172.16.60.1) from 172.16.60.151 eth1: 56(84) bytes of data.
</code></pre><p>执行<code>route add default gw 172.16.60.1 eth1</code>后，可以ping 172.16.60.151,但是150有问题了.  </p>
<p>使用ssh root@172.16.60.151登陆看到的路由信息</p>
<pre><code>[root@localhost ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16.60.0     *               255.255.255.0   U     0      0        0 eth0
172.16.60.0     *               255.255.255.0   U     0      0        0 eth1
link-local      *               255.255.0.0     U     1002   0        0 eth0
default         172.16.60.1     0.0.0.0         UG    0      0        0 eth1
default         172.16.60.1     0.0.0.0         UG    0      0        0 eth0
[root@localhost ~]# ping 172.16.60.1 -I eth0
PING 172.16.60.1 (172.16.60.1) from 172.16.60.150 eth0: 56(84) bytes of data.
64 bytes from 172.16.60.1: icmp_seq=1 ttl=255 time=8.88 ms
64 bytes from 172.16.60.1: icmp_seq=2 ttl=255 time=6.85 ms
64 bytes from 172.16.60.1: icmp_seq=3 ttl=255 time=1.74 ms
^C
--- 172.16.60.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2142ms
rtt min/avg/max/mdev = 1.747/5.830/8.885/3.003 ms
[root@localhost ~]# ping 172.16.60.1 -I eth1
PING 172.16.60.1 (172.16.60.1) from 172.16.60.151 eth1: 56(84) bytes of data.
^C
--- 172.16.60.1 ping statistics ---
17 packets transmitted, 0 received, 100% packet loss, time 16976ms

[root@localhost ~]# ping 172.16.50.39 -I eth0
PING 172.16.50.39 (172.16.50.39) from 172.16.60.150 eth0: 56(84) bytes of data.
^C
--- 172.16.50.39 ping statistics ---
13 packets transmitted, 0 received, 100% packet loss, time 12830ms

[root@localhost ~]# ping 172.16.50.39 -I eth1
PING 172.16.50.39 (172.16.50.39) from 172.16.60.151 eth1: 56(84) bytes of data.
64 bytes from 172.16.50.39: icmp_seq=1 ttl=63 time=0.245 ms
64 bytes from 172.16.50.39: icmp_seq=2 ttl=63 time=0.296 ms
^C
--- 172.16.50.39 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1391ms
rtt min/avg/max/mdev = 0.245/0.270/0.296/0.030 ms
[root@localhost ~]# ping 172.16.60.53 -I eth0
PING 172.16.60.53 (172.16.60.53) from 172.16.60.150 eth0: 56(84) bytes of data.
64 bytes from 172.16.60.53: icmp_seq=1 ttl=64 time=0.252 ms
64 bytes from 172.16.60.53: icmp_seq=2 ttl=64 time=0.196 ms
^C
--- 172.16.60.53 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1342ms
rtt min/avg/max/mdev = 0.196/0.224/0.252/0.028 ms
[root@localhost ~]# ping 172.16.60.53 -I eth1
PING 172.16.60.53 (172.16.60.53) from 172.16.60.151 eth1: 56(84) bytes of data.
64 bytes from 172.16.60.53: icmp_seq=1 ttl=64 time=0.236 ms
64 bytes from 172.16.60.53: icmp_seq=2 ttl=64 time=0.232 ms
64 bytes from 172.16.60.53: icmp_seq=3 ttl=64 time=0.240 ms
^C
--- 172.16.60.53 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2431ms
rtt min/avg/max/mdev = 0.232/0.236/0.240/0.003 ms
</code></pre><p><strong>这时候应该怎么设置route呢?</strong></p>
<p>可是没有看出哪里有问题，发往172.16.60.XX ip段的都从eth0走，其他IP段的从eth0发送给默认网关172.16.60.1</p>
<h3 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h3><ul>
<li><a href="http://linux.vbird.org/linux_server/0150detect_network.php" target="_blank" rel="external">Linux 網路偵錯</a></li>
<li><a href="http://my.oschina.net/jing31/blog/6611" target="_blank" rel="external">Linux双网卡设置IP属于同一网段的问题</a></li>
<li><a href="http://os.51cto.com/art/201205/339800.htm" target="_blank" rel="external">Linux系统IP路由的工作原理</a></li>
<li><a href="http://linux.vbird.org/linux_server/0230router.php" target="_blank" rel="external">路由觀念與路由器設定</a></li>
<li><a href="http://my.oschina.net/guol/blog/156607" target="_blank" rel="external">Linux策略路由</a></li>
<li><a href="http://yuangeqingtian.blog.51cto.com/6994701/1218946" target="_blank" rel="external">linux下路由表详解</a></li>
<li><a href="http://www.centoscn.com/CentOS/Intermediate/2013/0915/1633.html" target="_blank" rel="external">CentOS双网卡策略路由测试</a></li>
<li><a href="http://my.oschina.net/7shell/blog/308887" target="_blank" rel="external">Linux双网卡(内外网)同时使用路由设置</a></li>
<li><a href="http://forum.ubuntu.org.cn/viewtopic.php?f=54&amp;t=327616" target="_blank" rel="external">linux双网卡实现局域网跨网段访问</a></li>
<li><a href="http://blog.csdn.net/zhuying_linux/article/details/6770730" target="_blank" rel="external">ping工作原理</a></li>
<li><a href="http://stackoverflow.com/questions/18536796/icmp-request-received-but-doesnt-reply" target="_blank" rel="external">icmp request received, but doesn’t reply</a></li>
<li><a href="https://access.redhat.com/solutions/53031" target="_blank" rel="external">https://access.redhat.com/solutions/53031</a></li>
<li><a href="http://fengyun.blog.51cto.com/532912/608713" target="_blank" rel="external">杂谈icmp</a></li>
<li><a href="http://leo0216.blog.51cto.com/188904/84863" target="_blank" rel="external">LINUX ROUTE配置小记</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2015/03/11/understand-linux-route/" data-id="ciqqpe1sg00c2nmpv4re9r716" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/linux/">linux</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-message-queue-middleware" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2015/02/09/message-queue-middleware/" class="article-date">
  <time datetime="2015-02-08T16:00:00.000Z" itemprop="datePublished">2015-02-09</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/linux/">linux</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2015/02/09/message-queue-middleware/">Message Queue Middleware</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Introduce"><a href="#Introduce" class="headerlink" title="Introduce"></a>Introduce</h3><ul>
<li>MOM: Message Oriented Middleware</li>
<li>Message Queue ( MQ ) is a middleware between applications and networks.</li>
</ul>
<p>There are a number of open source choices of messaging middleware systems, including   </p>
<ul>
<li>JBoss Messaging </li>
<li>JORAM </li>
<li><a href="http://en.wikipedia.org/wiki/Apache_ActiveMQ" target="_blank" rel="external">Apache ActiveMQ</a></li>
<li>Sun Open Message Queue </li>
<li>Apache Qpid</li>
<li><a href="http://en.wikipedia.org/wiki/RabbitMQ" target="_blank" rel="external">RabbitMQ</a></li>
<li>Beanstalkd </li>
<li>Tarantool </li>
<li>HTTPSQS</li>
<li><a href="http://en.wikipedia.org/wiki/Microsoft_Message_Queuing" target="_blank" rel="external">MSMQ</a></li>
</ul>
<h3 id="Compare"><a href="#Compare" class="headerlink" title="Compare"></a>Compare</h3><ul>
<li>Application A &lt;–&gt; Network &lt;–&gt; Application B</li>
<li>Application A &lt;–&gt; MOM &lt;—&gt; Application B</li>
</ul>
<h3 id="Standard-and-protocol"><a href="#Standard-and-protocol" class="headerlink" title="Standard and protocol"></a>Standard and protocol</h3><ul>
<li>AMQP</li>
</ul>
<h3 id="Using-ActiveMQ"><a href="#Using-ActiveMQ" class="headerlink" title="Using ActiveMQ"></a>Using ActiveMQ</h3><p><strong>1.Download and run activemq</strong>:  </p>
<ul>
<li>Download the latest activemq from <a href="http://activemq.apache.org/download.html" target="_blank" rel="external">http://activemq.apache.org/download.html</a></li>
<li>tar xvf apache-activemq-5.11.0-bin.tar.gz </li>
<li>cd apache-activemq-5.11.0</li>
<li>./bin/activemq start </li>
<li><a href="http://localhost:8161" target="_blank" rel="external">http://localhost:8161</a>. The default username and password is admin/admin</li>
<li>check running: <ul>
<li>netstat -apn |grep 61616</li>
<li>ps aux |grep activemq</li>
</ul>
</li>
<li>./bin/activemq stop</li>
<li>for more information, read docs/user-guide.html </li>
</ul>
<p><strong>2.Build openwire-cpp example</strong>:  </p>
<ul>
<li>yum install activemq-cpp-devel</li>
<li>cd /home/dennis/Downloads/apache-activemq-5.11.0/examples/openwire/cpp </li>
<li>gcc Listener.cpp -o listener -I/usr/include/activemq-cpp-3.8.3 -I/usr/include/apr-1 -lactivemq-cpp -lstdc++</li>
<li>gcc Publisher.cpp -o publisher -I/usr/include/activemq-cpp-3.8.3 -I/usr/include/apr-1 -lactivemq-cpp -lstdc++</li>
</ul>
<p><strong>3.Running example</strong>:  </p>
<ul>
<li><p>3.1 Run service as root </p>
<p>  [dennis@localhost apache-activemq-5.11.0]$ su<br>  Password:<br>  [root@localhost apache-activemq-5.11.0]# ./bin/activemq start<br>  INFO: Loading ‘/home/dennis/Downloads/apache-activemq-5.11.0/bin/env’<br>  INFO: Using java ‘/usr/bin/java’<br>  INFO: Process with pid ‘3510’ is already running</p>
</li>
<li><p>3.2 Run listener  </p>
<h1 id="dennis-localhost-cpp-listener"><a href="#dennis-localhost-cpp-listener" class="headerlink" title="  [dennis@localhost cpp]$ ./listener "></a>  [dennis@localhost cpp]$ ./listener </h1><h2 id="Starting-the-Listener-example"><a href="#Starting-the-Listener-example" class="headerlink" title="  Starting the Listener example:"></a>  Starting the Listener example:</h2><p>  Waiting for messages…<br>  Received 1000 messages.<br>  Received 2000 messages.<br>  Received 3000 messages.<br>  Received 4000 messages.<br>  Received 5000 messages.<br>  Received 6000 messages.<br>  Received 7000 messages.<br>  Received 8000 messages.<br>  Received 9000 messages.<br>  Received 10000 messages.</p>
<h2 id="Received-10000-in-1-606-seconds"><a href="#Received-10000-in-1-606-seconds" class="headerlink" title="  Received 10000 in 1.606 seconds"></a>  Received 10000 in 1.606 seconds</h2><h1 id="Finished-with-the-example"><a href="#Finished-with-the-example" class="headerlink" title="  Finished with the example."></a>  Finished with the example.</h1></li>
<li><p>3.3 Run publisher  </p>
<h1 id="dennis-localhost-cpp-publisher"><a href="#dennis-localhost-cpp-publisher" class="headerlink" title="  [dennis@localhost cpp]$ ./publisher "></a>  [dennis@localhost cpp]$ ./publisher </h1><h2 id="Starting-the-Publisher-example"><a href="#Starting-the-Publisher-example" class="headerlink" title="  Starting the Publisher example:"></a>  Starting the Publisher example:</h2><p>  Sent 1000 messages<br>  Sent 2000 messages<br>  Sent 3000 messages<br>  Sent 4000 messages<br>  Sent 5000 messages<br>  Sent 6000 messages<br>  Sent 7000 messages<br>  Sent 8000 messages<br>  Sent 9000 messages</p>
<h2 id="Sent-10000-messages"><a href="#Sent-10000-messages" class="headerlink" title="  Sent 10000 messages"></a>  Sent 10000 messages</h2><h1 id="Finished-with-the-example-1"><a href="#Finished-with-the-example-1" class="headerlink" title="  Finished with the example."></a>  Finished with the example.</h1></li>
</ul>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://en.wikipedia.org/wiki/Message_queue" target="_blank" rel="external">Message Queue</a></li>
<li><a href="http://en.wikipedia.org/wiki/Message-oriented_middleware" target="_blank" rel="external">Message-oriented middleware</a></li>
<li><a href="http://blog.fity.cn/post/377/" target="_blank" rel="external">消息队列中间件的技术选型分析</a></li>
<li><a href="http://www.infoq.com/cn/articles/apache-kafka" target="_blank" rel="external">Apache Kafka：下一代分布式消息系统</a></li>
<li>★★★<a href="http://alibaba.github.io/RocketMQ-docs/document/openuser/mqvsmq.pdf" target="_blank" rel="external">消息队列中间件调研文档</a></li>
<li><a href="http://www.ibm.com/developerworks/cn/websphere/library/techarticles/loulijun/MQnewer/MQnewer.html" target="_blank" rel="external">消息中间件及WebSphere MQ入门</a></li>
<li><a href="https://github.com/zeromq" target="_blank" rel="external">The ZeroMQ project</a></li>
<li><a href="http://api.zeromq.org/" target="_blank" rel="external">api of zeroMQ</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2015/02/09/message-queue-middleware/" data-id="ciqqpe1sd00c0nmpvrnhy2dcu" class="article-share-link">Partager</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-linux-network-performance-monitor" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2015/01/21/linux-network-performance-monitor/" class="article-date">
  <time datetime="2015-01-20T16:00:00.000Z" itemprop="datePublished">2015-01-21</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/tools/">tools</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2015/01/21/linux-network-performance-monitor/">linux network performance monitor</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="ethtool"><a href="#ethtool" class="headerlink" title="ethtool"></a>ethtool</h3><h3 id="iptraf"><a href="#iptraf" class="headerlink" title="iptraf"></a>iptraf</h3><h3 id="netperf"><a href="#netperf" class="headerlink" title="netperf"></a>netperf</h3><h3 id="iperf"><a href="#iperf" class="headerlink" title="iperf"></a>iperf</h3><p>Build from source:  </p>
<pre><code>[root@localhost ~]# tar xvf iperf-2.0.5.tar.gz 
...
[root@localhost ~]# cd iperf-2.0.5
[root@localhost iperf-2.0.5]# ./configure 
...
[root@localhost iperf-2.0.5]# make
...
</code></pre><p>On server machine:  </p>
<pre><code>[root@Ustor iperf-2.0.5]# ./src/iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local 192.16.110.80 port 5001 connected with 192.16.110.50 port 43341
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.0 sec  9.20 GBytes  7.90 Gbits/sec
[  5] local 192.16.110.80 port 5001 connected with 192.16.110.50 port 43342
[  5]  0.0-10.0 sec  9.26 GBytes  7.95 Gbits/sec
[  4] local 192.16.110.80 port 5001 connected with 192.16.110.50 port 43343
[  4]  0.0-10.0 sec  8.98 GBytes  7.71 Gbits/sec
</code></pre><p>On Client machine:  </p>
<pre><code>[root@localhost iperf-2.0.5]# ./src/iperf -c 192.16.110.80 -f M -i 2
------------------------------------------------------------
Client connecting to 192.16.110.80, TCP port 5001
TCP window size: 0.02 MByte (default)
------------------------------------------------------------
[  3] local 192.16.110.50 port 43343 connected with 192.16.110.80 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 2.0 sec  1598 MBytes   799 MBytes/sec
[  3]  2.0- 4.0 sec  1919 MBytes   960 MBytes/sec
[  3]  4.0- 6.0 sec  1892 MBytes   946 MBytes/sec
[  3]  6.0- 8.0 sec  1894 MBytes   947 MBytes/sec
[  3]  8.0-10.0 sec  1893 MBytes   947 MBytes/sec
[  3]  0.0-10.0 sec  9196 MBytes   920 MBytes/sec
</code></pre><ul>
<li>通用参数<ul>
<li>-f [k|m|K|M] 分别表示以Kbits, Mbits, KBytes, MBytes显示报告，默认以Mbits为单位,eg:iperf -c 222.35.11.23 -f K</li>
<li>-i sec 以秒为单位显示报告间隔，eg:iperf -c 222.35.11.23 -i 2</li>
<li>-l 缓冲区大小，默认是8KB,eg:iperf -c 222.35.11.23 -l 16</li>
<li>-m 显示tcp最大mtu值</li>
<li>-o 将报告和错误信息输出到文件eg:iperf -c 222.35.11.23 -o c:\iperflog.txt</li>
<li>-p 指定服务器端使用的端口或客户端所连接的端口eg:iperf -s -p 9999;iperf -c 222.35.11.23 -p 9999</li>
<li>-u 使用udp协议,测试htb的时候最好用udp，udp通信开销小，测试的带宽更准确</li>
<li>-w 指定TCP窗口大小，默认是8KB.如果窗口太小，有可能丢包</li>
<li>-B 绑定一个主机地址或接口（当主机有多个地址或接口时使用该参数）</li>
<li>-C 兼容旧版本（当server端和client端版本不一样时使用）</li>
<li>-M 设定TCP数据包的最大mtu值</li>
<li>-N 设定TCP不延时</li>
<li>-V 传输ipv6数据包</li>
</ul>
</li>
<li>server专用参数<ul>
<li>-D 以服务方式运行ipserf，eg:iperf -s -D</li>
<li>-R 停止iperf服务，针对-D，eg:iperf -s -R</li>
</ul>
</li>
<li>client端专用参数<ul>
<li>-d 同时进行双向传输测试</li>
<li>-n 指定传输的字节数，eg:iperf -c 222.35.11.23 -n 100000</li>
<li>-r 单独进行双向传输测试</li>
<li>-b 指定发送带宽，默认是1Mbit/s. 在测试qos的时候，这是最有用的参数。</li>
<li>-t 测试时间，默认10秒,eg:iperf -c 222.35.11.23 -t 5.默认是10s</li>
<li>-F 指定需要传输的文件</li>
<li>-T 指定ttl值 </li>
</ul>
</li>
</ul>
<h3 id="tcpdump-tcptrace"><a href="#tcpdump-tcptrace" class="headerlink" title="tcpdump tcptrace"></a>tcpdump tcptrace</h3><ul>
<li>tcpdump -i eth0</li>
<li>tcpdump -i eth0 host 172.16.30.44 and port 80</li>
<li>tcpdump -U port 3260 -w /tmp/tcpdump.pcap</li>
</ul>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://www.vpsee.com/2009/11/linux-system-performance-monitoring-network/" target="_blank" rel="external">Linux性能监测：network</a></li>
<li><a href="http://blog.chinaunix.net/uid-20778443-id-94533.html" target="_blank" rel="external">iperf 使用总结</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2015/01/21/linux-network-performance-monitor/" data-id="ciqqpe1sa00bwnmpvrm56d4q9" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/network/">network</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/performance/">performance</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-checking-speed-of-network" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/12/31/checking-speed-of-network/" class="article-date">
  <time datetime="2014-12-30T16:00:00.000Z" itemprop="datePublished">2014-12-31</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/network/">network</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/12/31/checking-speed-of-network/">checking network speed</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h4 id="一次网络性能检查记录"><a href="#一次网络性能检查记录" class="headerlink" title="一次网络性能检查记录"></a>一次网络性能检查记录</h4><ul>
<li><p>开始检查各种信息(网络、cpu,memory,io等)</p>
<pre><code>[root@Ustor ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 40:16:7E:35:C7:C2  
          inet addr:172.16.130.158  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: fe80::4216:7eff:fe35:c7c2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:37825154 errors:0 dropped:0 overruns:0 frame:0
          TX packets:214565 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2321429968 (2.1 GiB)  TX bytes:226462903 (215.9 MiB)
          Interrupt:16 Memory:dc400000-dc420000 

eth1      Link encap:Ethernet  HWaddr 40:16:7E:35:C7:C3  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:17 Memory:dc300000-dc320000 

eth2      Link encap:Ethernet  HWaddr 00:90:FA:6C:E4:0A  
          inet addr:192.16.110.50  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: fe80::290:faff:fe6c:e40a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:775026147 errors:0 dropped:1576 overruns:0 frame:0
          TX packets:1032091357 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:892065492548 (830.8 GiB)  TX bytes:1034532529750 (963.4 GiB)

eth3      Link encap:Ethernet  HWaddr 00:90:FA:6C:E4:0E  
          inet6 addr: fe80::290:faff:fe6c:e40e/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:6593 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5748 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2011976 (1.9 MiB)  TX bytes:345000 (336.9 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:21995 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21995 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1234012 (1.1 MiB)  TX bytes:1234012 (1.1 MiB)

[root@Ustor ~]# ping 192.16.110.60
PING 192.16.110.60 (192.16.110.60) 56(84) bytes of data.
64 bytes from 192.16.110.60: icmp_seq=1 ttl=128 time=0.147 ms
64 bytes from 192.16.110.60: icmp_seq=2 ttl=128 time=0.197 ms
64 bytes from 192.16.110.60: icmp_seq=3 ttl=128 time=0.195 ms
64 bytes from 192.16.110.60: icmp_seq=4 ttl=128 time=0.173 ms
64 bytes from 192.16.110.60: icmp_seq=5 ttl=128 time=0.197 ms
^C
--- 192.16.110.60 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4079ms
rtt min/avg/max/mdev = 0.147/0.181/0.197/0.026 ms

[root@Ustor ~]# route 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16.130.0    *               255.255.255.0   U     0      0        0 eth0
192.16.110.0    *               255.255.255.0   U     0      0        0 eth2
default         192.16.110.1    0.0.0.0         UG    0      0        0 eth2
default         172.16.130.1    0.0.0.0         UG    0      0        0 eth0
[root@Ustor ~]# ethtool -i eth2
driver: be2net
version: 4.1.307r
firmware-version: 10.0.803.19
bus-info: 0000:02:00.0
[root@Ustor ~]# ethtool eth2
Settings for eth2:
    Supported ports: [ FIBRE ]
    Supported link modes:   10000baseT/Full 
    Supports auto-negotiation: No
    Advertised link modes:  Not reported
    Advertised pause frame use: No
    Advertised auto-negotiation: No
    Speed: 10000Mb/s
    Duplex: Full
    Port: FIBRE
    PHYAD: 0
    Transceiver: external
    Auto-negotiation: off
    Supports Wake-on: g
    Wake-on: d
    Link detected: yes
[root@Ustor ~]# iostat 
Linux 2.6.32-279.el6.x86_64 (Ustor)     12/31/2014     _x86_64_    (2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.36    0.00    1.23    1.08    0.00   97.33

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               3.56        45.00        24.38   19491848   10557699
sdb              28.76      1274.39      2100.99  551950065  909958848
dm-0            224.75       639.32      1158.70  276896736  501843480
dm-1            197.05       634.96       941.44  275005928  407746632
dm-2              0.01         0.02         0.85      10001     368272

[root@Ustor ~]# fdisk -l

Disk /dev/sda: 8012 MB, 8012390400 bytes
255 heads, 63 sectors/track, 974 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x53c628b9

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26         287     2097152   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3             287         300      102400   83  Linux
Partition 3 does not end on cylinder boundary.
/dev/sda4             300         975     5419224    5  Extended
Partition 4 does not end on cylinder boundary.
/dev/sda5             300         313      102400   83  Linux
/dev/sda6             313         975     5314560   83  Linux

Disk /dev/sdb: 36002.0 GB, 36002026487808 bytes
255 heads, 63 sectors/track, 4376997 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
</code></pre></li>
</ul>
<pre><code>Disk /dev/mapper/r55-i01: 2097.2 GB, 2097152000000 bytes
255 heads, 63 sectors/track, 254964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x2c0893c9


Disk /dev/mapper/r55-i02: 2097.2 GB, 2097152000000 bytes
255 heads, 63 sectors/track, 254964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xcbbcf789


Disk /dev/mapper/r55-ee: 349.5 GB, 349526032384 bytes
255 heads, 63 sectors/track, 42494 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000


#### Hard Raid Card ####
[root@Ustor ~]# lspci  
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 05)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b5)
00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 (rev b5)
00:1c.5 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 6 (rev b5)
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 05)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev a5)
00:1f.0 ISA bridge: Intel Corporation C202 Chipset Family LPC Controller (rev 05)
00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family SATA AHCI Controller (rev 05)
00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 05)
01:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05)
02:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
02:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
03:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
04:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
05:05.0 VGA compatible controller: ASPEED Technology, Inc. ASPEED Graphics Family (rev 10)

[root@Ustor ~]# MegaCli -LdPdInfo -aAll

Adapter #0

Number of Virtual Disks: 1
Virtual Drive: 0 (Target Id: 0)
Name                :r55
RAID Level          : Primary-5, Secondary-0, RAID Level Qualifier-3
Size                : 32.743 TB
Parity Size         : 3.637 TB
State               : Optimal
Strip Size          : 64 KB
Number Of Drives    : 10
Span Depth          : 1
Default Cache Policy: WriteBack, ReadAdaptive, Cached, Write Cache OK if Bad BBU
Current Cache Policy: WriteBack, ReadAdaptive, Cached, Write Cache OK if Bad BBU
Default Access Policy: Read/Write
Current Access Policy: Read/Write
Disk Cache Policy   : Enabled
Encryption Type     : None
Bad Blocks Exist: No
Is VD Cached: No
Number of Spans: 1
Span: 0 - Number of PDs: 10

[root@Ustor ~]# MegaCli -LdPdInfo -aAll |grep -i &apos;raw size&apos;
Raw Size: 3.638 TB [0x1d1c0beb0 Sectors]
Raw Size: 3.638 TB [0x1d1c0beb0 Sectors]
Raw Size: 3.638 TB [0x1d1c0beb0 Sectors]
Raw Size: 3.638 TB [0x1d1c0beb0 Sectors]
Raw Size: 3.638 TB [0x1d1c0beb0 Sectors]
Raw Size: 3.638 TB [0x1d1c0beb0 Sectors]
Raw Size: 3.638 TB [0x1d1c0beb0 Sectors]
Raw Size: 3.638 TB [0x1d1c0beb0 Sectors]
Raw Size: 3.638 TB [0x1d1c0beb0 Sectors]
Raw Size: 3.638 TB [0x1d1c0beb0 Sectors]

#### /dev/sdb的大小是36002GB, 即 36002/1024=35.158TB ####
#### 可是整个raid的大小应该时3.637TB * 9 = 32.733TB才对, 为什么下面/dev/sdb是35.158TB呢 ####
[root@Ustor ~]# fdisk -l /dev/sdb

Disk /dev/sdb: 36002.0 GB, 36002026487808 bytes
255 heads, 63 sectors/track, 4376997 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

[root@Ustor ~]# iostat 1
Linux 2.6.32-279.el6.x86_64 (Ustor)     12/31/2014     _x86_64_    (2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.37    0.00    1.25    1.08    0.00   97.30

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               3.57        46.38        24.39   20146336   10593379
sdb              28.77      1270.72      2136.50  551950697  928014000
dm-0            229.04       637.48      1194.85  276896840  518997016
dm-1            196.74       633.13       940.80  275006032  408647752
dm-2              0.01         0.02         0.85      10169     368768

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.00    0.00   18.59    0.00    0.00   81.41

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               0.00         0.00         0.00          0          0
sdb              72.00         0.00     24584.00          0      24584
dm-0              0.00         0.00         0.00          0          0
dm-1           3072.00         0.00     24576.00          0      24576
dm-2              1.00         0.00         8.00          0          8

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.00    0.00   11.50    0.00    0.00   88.50

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               0.00         0.00         0.00          0          0
sdb              37.00         0.00     16400.00          0      16400
dm-0              0.00         0.00         0.00          0          0
dm-1           2048.00         0.00     16384.00          0      16384
dm-2              2.00         0.00        16.00          0         16

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           5.05    0.00   18.69    0.00    0.00   76.26

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               0.00         0.00         0.00          0          0
sdb              72.00         0.00     32768.00          0      32768
dm-0              0.00         0.00         0.00          0          0
dm-1           4096.00         0.00     32768.00          0      32768
dm-2              0.00         0.00         0.00          0          0

#### dd的速度达到1GB/s，说明瓶颈不在磁盘 ####
[root@Ustor ~]# dd if=/dev/zero of=/dev/sdb bs=1M count=102400
28309+0 records in
28309+0 records out
29684137984 bytes (30 GB) copied, 28.4613 s, 1.0 GB/s
33270+0 records in
33270+0 records out
34886123520 bytes (35 GB) copied, 33.4982 s, 1.0 GB/s
38234+0 records in
38234+0 records out
40091254784 bytes (40 GB) copied, 38.5252 s, 1.0 GB/s
^C42879+0 records in
42879+0 records out
44961890304 bytes (45 GB) copied, 43.2484 s, 1.0 GB/s

[root@Ustor ~]# ls /dev/r55/
ee  i01  i02
[root@Ustor ~]# ls /dev/r55/ee -l
lrwxrwxrwx 1 root root 7 Dec 30 16:42 /dev/r55/ee -&gt; ../dm-2
[root@Ustor ~]# dd if=/dev/zero of=/dev/r55/ee bs=1M count=1024000
2552+0 records in
2552+0 records out
2675965952 bytes (2.7 GB) copied, 2.31478 s, 1.2 GB/s
7516+0 records in
7516+0 records out
7881097216 bytes (7.9 GB) copied, 7.34263 s, 1.1 GB/s

[root@Ustor ~]# dd if=/dev/zero of=/dev/r55/i01 bs=1M count=1024000
2869+0 records in
2869+0 records out
3008364544 bytes (3.0 GB) copied, 2.73699 s, 1.1 GB/s
7841+0 records in
7841+0 records out
8221884416 bytes (8.2 GB) copied, 7.76994 s, 1.1 GB/s

[root@Ustor ~]# dd if=/dev/zero of=/dev/r55/i02 bs=1M count=1024000
^[OH2751+0 records in
2751+0 records out
2884632576 bytes (2.9 GB) copied, 2.53248 s, 1.1 GB/s
7704+1 records in
7704+0 records out
8078229504 bytes (8.1 GB) copied, 7.56027 s, 1.1 GB/s

[root@Ustor ~]# blockdev --report /dev/sdb
RO    RA   SSZ   BSZ   StartSec            Size   Device
rw   256   512  4096          0  36002026487808   /dev/sdb
[root@Ustor ~]# blockdev --report /dev/r55/ee 
RO    RA   SSZ   BSZ   StartSec            Size   Device
rw 16384   512  4096          0    349526032384   /dev/r55/ee
[root@Ustor ~]# blockdev --report /dev/r55/i01
RO    RA   SSZ   BSZ   StartSec            Size   Device
rw   256   512  4096          0   2097152000000   /dev/r55/i01
[root@Ustor ~]# blockdev --report /dev/r55/i02
RO    RA   SSZ   BSZ   StartSec            Size   Device
rw   256   512  4096          0   2097152000000   /dev/r55/i0

[root@Ustor ~]# sysctl -a |grep ipv4.tcp
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_sack = 1
net.ipv4.tcp_retrans_collapse = 1
net.ipv4.tcp_syn_retries = 5
net.ipv4.tcp_synack_retries = 5
net.ipv4.tcp_max_orphans = 131072
net.ipv4.tcp_max_tw_buckets = 131072
net.ipv4.tcp_keepalive_time = 7200
net.ipv4.tcp_keepalive_probes = 9
net.ipv4.tcp_keepalive_intvl = 75
net.ipv4.tcp_retries1 = 3
net.ipv4.tcp_retries2 = 15
net.ipv4.tcp_fin_timeout = 60
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_abort_on_overflow = 0
net.ipv4.tcp_stdurg = 0
net.ipv4.tcp_rfc1337 = 0
net.ipv4.tcp_max_syn_backlog = 1024
net.ipv4.tcp_orphan_retries = 0
net.ipv4.tcp_fack = 1
net.ipv4.tcp_reordering = 3
net.ipv4.tcp_ecn = 2
net.ipv4.tcp_dsack = 1
net.ipv4.tcp_mem = 173856    231808    347712
net.ipv4.tcp_wmem = 4096    16384    4194304
net.ipv4.tcp_rmem = 4096    87380    4194304
net.ipv4.tcp_app_win = 31
net.ipv4.tcp_adv_win_scale = 2
net.ipv4.tcp_tw_reuse = 0
net.ipv4.tcp_frto = 2
net.ipv4.tcp_frto_response = 0
net.ipv4.tcp_low_latency = 0
net.ipv4.tcp_no_metrics_save = 0
net.ipv4.tcp_moderate_rcvbuf = 1
net.ipv4.tcp_tso_win_divisor = 3
net.ipv4.tcp_congestion_control = cubic
net.ipv4.tcp_abc = 0
net.ipv4.tcp_mtu_probing = 0
net.ipv4.tcp_base_mss = 512
net.ipv4.tcp_workaround_signed_windows = 0
net.ipv4.tcp_dma_copybreak = 4096
net.ipv4.tcp_slow_start_after_idle = 1
net.ipv4.tcp_available_congestion_control = cubic reno
net.ipv4.tcp_allowed_congestion_control = cubic reno
net.ipv4.tcp_max_ssthresh = 0
net.ipv4.tcp_thin_linear_timeouts = 0
net.ipv4.tcp_thin_dupack = 0

[root@Ustor ~]# ethtool -k eth2
Offload parameters for eth2:
rx-checksumming: on
tx-checksumming: on
scatter-gather: on
tcp-segmentation-offload: on
udp-fragmentation-offload: off
generic-segmentation-offload: on
generic-receive-offload: off
large-receive-offload: off

[root@Ustor ~]# tcpdump -i eth2 -w /tmp/tcpdump01.pcap
tcpdump: listening on eth2, link-type EN10MB (Ethernet), capture size 65535 bytes
^C154277 packets captured
979189 packets received by filter
824910 packets dropped by kernel
[root@Ustor ~]# ls /tmp/tcpdump01.pcap -lh
-rw-r--r-- 1 root root 187M Dec 31 10:47 /tmp/tcpdump01.pcap
</code></pre><ul>
<li><p>tshark 分析</p>
<pre><code>#### scp下载包到本地，使用tshark分析 ####
[dennis@localhost ~]$ scp root@172.16.130.158:/tmp/tcpdump01.pcap ./
root@172.16.130.158&apos;s password: 
tcpdump01.pcap                         100%  186MB  11.0MB/s   00:17 
[dennis@localhost ~]$ capinfos tcpdump01.pcap 
File name:           tcpdump01.pcap
File type:           Wireshark/tcpdump/... - pcap
File encapsulation:  Ethernet
Packet size limit:   file hdr: 65535 bytes
Number of packets:   154 k
File size:           195 MB
Data size:           192 MB
Capture duration:    40 seconds
Start time:          Wed Dec 31 10:47:13 2014
End time:            Wed Dec 31 10:47:53 2014
Data byte rate:      4,816 kBps
Data bit rate:       38 Mbps
Average packet size: 1249.82 bytes
Average packet rate: 3,853 packets/sec
SHA1:                b08cff272eb5b0d9aa64fb31343314603df44309
RIPEMD160:           70123da08082954af0d91dde9d9766a61c0a93db
MD5:                 0571ac4f35410047a13cdfbd3bf3bfe9
Strict time order:   False

#### 重传好像影响不大? ####
[dennis@localhost ~]$ tshark -n -q -r tcpdump01.pcap  -z &quot;io,stat,0,tcp.analysis.retransmission&quot;

=======================================================
| IO Statistics                                       |
|                                                     |
| Interval size: 40.0 secs (dur)                      |
| Col 1: Frames and bytes                             |
|     2: tcp.analysis.retransmission                  |
|-----------------------------------------------------|
|              |1                   |2                |
| Interval     | Frames |   Bytes   | Frames |  Bytes |
|-----------------------------------------------------|
|  0.0 &lt;&gt; 40.0 | 154277 | 192818724 |    141 | 191110 |
=======================================================
[dennis@localhost ~]$ tshark -n -q -r tcpdump01.pcap  -z &quot;io,stat,0,tcp.analysis.out_of_order&quot;

=======================================================
| IO Statistics                                       |
|                                                     |
| Interval size: 40.0 secs (dur)                      |
| Col 1: Frames and bytes                             |
|     2: tcp.analysis.out_of_order                    |
|-----------------------------------------------------|
|              |1                   |2                |
| Interval     | Frames |   Bytes   | Frames |  Bytes |
|-----------------------------------------------------|
|  0.0 &lt;&gt; 40.0 | 154277 | 192818724 |    620 | 898920 |
=======================================================
[dennis@localhost ~]$ tshark -n -q -r tcpdump01.pcap  -z &quot;io,stat,5,tcp.analysis.out_of_order&quot;

==================================================
| IO Statistics                                  |
|                                                |
| Interval size: 5 secs                          |
| Col 1: Frames and bytes                        |
|     2: tcp.analysis.out_of_order               |
|------------------------------------------------|
|          |1                  |2                |
| Interval | Frames |   Bytes  | Frames |  Bytes |
|------------------------------------------------|
|  0 &lt;&gt;  5 |  10837 | 14246599 |      1 |   1514 |
|  5 &lt;&gt; 10 |  49803 | 61236860 |    184 | 264780 |
| 10 &lt;&gt; 15 |  48890 | 61739426 |    186 | 271384 |
| 15 &lt;&gt; 20 |  42976 | 55481613 |    249 | 361242 |
| 20 &lt;&gt; 25 |    397 |    24870 |      0 |      0 |
| 25 &lt;&gt; 30 |    461 |    29156 |      0 |      0 |
| 30 &lt;&gt; 35 |    488 |    31931 |      0 |      0 |
| 35 &lt;&gt; 40 |    421 |    28029 |      0 |      0 |
| 40 &lt;&gt; 40 |      4 |      240 |      0 |      0 |
==================================================
[dennis@localhost ~]$ tshark -n -q -r tcpdump01.pcap  -z &quot;io,stat,5,tcp.analysis.retransmission&quot;

=================================================
| IO Statistics                                 |
|                                               |
| Interval size: 5 secs                         |
| Col 1: Frames and bytes                       |
|     2: tcp.analysis.retransmission            |
|-----------------------------------------------|
|          |1                  |2               |
| Interval | Frames |   Bytes  | Frames | Bytes |
|-----------------------------------------------|
|  0 &lt;&gt;  5 |  10837 | 14246599 |      3 |  4542 |
|  5 &lt;&gt; 10 |  49803 | 61236860 |     62 | 85484 |
| 10 &lt;&gt; 15 |  48890 | 61739426 |     41 | 53682 |
| 15 &lt;&gt; 20 |  42976 | 55481613 |     35 | 47402 |
| 20 &lt;&gt; 25 |    397 |    24870 |      0 |     0 |
| 25 &lt;&gt; 30 |    461 |    29156 |      0 |     0 |
| 30 &lt;&gt; 35 |    488 |    31931 |      0 |     0 |
| 35 &lt;&gt; 40 |    421 |    28029 |      0 |     0 |
| 40 &lt;&gt; 40 |      4 |      240 |      0 |     0 |
=================================================
[dennis@localhost ~]$ 
</code></pre></li>
</ul>
<ul>
<li><p>会不会网卡驱动有问题?据说这个Emulex卡直接装就可以用，不用单独安装驱动</p>
<pre><code>[root@Ustor ~]# modinfo be2net
filename:       /lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/net/benet/be2net.ko
license:        GPL
author:         ServerEngines Corporation
description:    ServerEngines BladeEngine 10Gbps NIC Driver 4.1.307r
version:        4.1.307r
srcversion:     7076CA6C80C3CD968BAFFFC
alias:          pci:v000010DFd00000720sv*sd*bc*sc*i*
alias:          pci:v000010DFd0000E228sv*sd*bc*sc*i*
alias:          pci:v000010DFd0000E220sv*sd*bc*sc*i*
alias:          pci:v000019A2d00000710sv*sd*bc*sc*i*
alias:          pci:v000019A2d00000700sv*sd*bc*sc*i*
alias:          pci:v000019A2d00000221sv*sd*bc*sc*i*
alias:          pci:v000019A2d00000211sv*sd*bc*sc*i*
depends:        
vermagic:       2.6.32-279.el6.x86_64 SMP mod_unload modversions 
parm:           num_vfs:Number of PCI VFs to initialize (uint)
parm:           multi_rxq:Obsolete and used only for compatibility (bool)
parm:           rx_frag_size:Size of a fragment that holds rcvd data. (ushort)
[root@Ustor ~]# lspci -nn |grep Emulex
02:00.0 Ethernet controller [0200]: Emulex Corporation OneConnect 10Gb NIC (be3) [19a2:0710] (rev 01)
02:00.1 Ethernet controller [0200]: Emulex Corporation OneConnect 10Gb NIC (be3) [19a2:0710] (rev 01)
型号是19a2:0710
[root@Ustor ~]# grep -irn &apos;19a2.*0710&apos; /lib/modules/2.6.32-279.el6.x86_64/modules.alias
3732:alias pci:v000019A2d00000710sv*sd*bc*sc*i* be2net
</code></pre></li>
<li><p>修改磁盘预读大小，性能没什么提升，依然再100MB/s左右，查看windows下的网络曲线，不够平整</p>
<pre><code>[root@Ustor SOURCES]# blockdev --report
RO    RA   SSZ   BSZ   StartSec            Size   Device
rw 16384   512  4096          0      8012390400   /dev/sda
rw 16384   512  1024       2048       209715200   /dev/sda1
rw 16384   512  4096     411648      2147483648   /dev/sda2
rw 16384   512  1024    4605952       104857600   /dev/sda3
rw 16384   512  1024    4810752            1024   /dev/sda4
rw 16384   512  1024    4812800       104857600   /dev/sda5
rw 16384   512  4096    5019648      5442109440   /dev/sda6
rw   256   512  4096          0  36002026487808   /dev/sdb
rw   256   512  4096          0   2097152000000   /dev/dm-0
rw   256   512  4096          0   2097152000000   /dev/dm-1
rw 16384   512  4096          0    349526032384   /dev/dm-2
[root@Ustor SOURCES]# blockdev --setra 16384 /dev/dm-1
[root@Ustor SOURCES]# blockdev --setra 16384 /dev/dm-0
[root@Ustor SOURCES]# blockdev --setra 16384 /dev/sdb
[root@Ustor SOURCES]# blockdev --report
RO    RA   SSZ   BSZ   StartSec            Size   Device
rw 16384   512  4096          0      8012390400   /dev/sda
rw 16384   512  1024       2048       209715200   /dev/sda1
rw 16384   512  4096     411648      2147483648   /dev/sda2
rw 16384   512  1024    4605952       104857600   /dev/sda3
rw 16384   512  1024    4810752            1024   /dev/sda4
rw 16384   512  1024    4812800       104857600   /dev/sda5
rw 16384   512  4096    5019648      5442109440   /dev/sda6
rw 16384   512  4096          0  36002026487808   /dev/sdb
rw 16384   512  4096          0   2097152000000   /dev/dm-0
rw 16384   512  4096          0   2097152000000   /dev/dm-1
rw 16384   512  4096          0    349526032384   /dev/dm-2
</code></pre></li>
</ul>
<p>发现4k;0% read;0% random的速度比1M;0%read;0%random的快，<br>通常都是1M的快。。。<br>4k有10G的25%左右速度，速度曲线相对平整；而1M只有8%左右，而且速度曲线极其不平整；</p>
<ul>
<li><p>使用rmp source编译驱动</p>
<pre><code>rpm -ivh be2net-10.2.470.14-1.src.rpm
cd rpmbuild/SOURCES
tar xvf be2net-10.2.470.14.tar.gz 
cd be2net-10.2.470.14 
make
cp /lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/net/benet/be2net.ko{,.bak}
cp ./be2net.ko /lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/net/benet/be2net.ko
modinfo be2net
reboot
ethtool -i be2net

[root@Ustor be2net-10.2.470.14]# modinfo ./be2net.ko
filename:       ./be2net.ko
supported:      external
license:        GPL
author:         Emulex Corporation
description:    Emulex OneConnect NIC Driver 10.2.470.14
version:        10.2.470.14
srcversion:     DE6CC9D92A3CE9C042DA005
alias:          pci:v000010DFd00000728sv*sd*bc*sc*i*
alias:          pci:v000010DFd00000730sv*sd*bc*sc*i*
alias:          pci:v000010DFd00000720sv*sd*bc*sc*i*
alias:          pci:v000010DFd0000E228sv*sd*bc*sc*i*
alias:          pci:v000010DFd0000E220sv*sd*bc*sc*i*
alias:          pci:v000019A2d00000710sv*sd*bc*sc*i*
alias:          pci:v000019A2d00000700sv*sd*bc*sc*i*
alias:          pci:v000019A2d00000221sv*sd*bc*sc*i*
alias:          pci:v000019A2d00000211sv*sd*bc*sc*i*
depends:        
vermagic:       2.6.32-279.el6.x86_64 SMP mod_unload modversions 
parm:           rss_on_mc:Enable RSS in multi-channel functions with the capability. Disabled by default. (ushort)
parm:           tx_prio:Create priority based TX queues. Disabled by default (uint)
parm:           num_vfs:Number of PCI VFs to initialize (uint)
parm:           rx_frag_size:Size of receive fragment buffer - 2048 (default), 4096 or 8192 (ushort)
parm:           gro:Enable or Disable GRO. Enabled by default (uint)
parm:           emi_canceller:Enable or Disable EMI Canceller. Disabled by default (uint)
</code></pre></li>
<li><p>更新驱动，重启机器</p>
<pre><code>[root@Ustor be2net-10.2.470.14]# cp be2net.ko /lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/net/benet/
[root@Ustor be2net-10.2.470.14]# ls /lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/net/benet/
be2net.ko  be2net.ko.bak
[root@Ustor be2net-10.2.470.14]# modinfo be2net
filename:       /lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/net/benet/be2net.ko
supported:      external
license:        GPL
author:         Emulex Corporation
description:    Emulex OneConnect NIC Driver 10.2.470.14
version:        10.2.470.14
srcversion:     DE6CC9D92A3CE9C042DA005
alias:          pci:v000010DFd00000728sv*sd*bc*sc*i*
alias:          pci:v000010DFd00000730sv*sd*bc*sc*i*
alias:          pci:v000010DFd00000720sv*sd*bc*sc*i*
alias:          pci:v000010DFd0000E228sv*sd*bc*sc*i*
alias:          pci:v000010DFd0000E220sv*sd*bc*sc*i*
alias:          pci:v000019A2d00000710sv*sd*bc*sc*i*
alias:          pci:v000019A2d00000700sv*sd*bc*sc*i*
alias:          pci:v000019A2d00000221sv*sd*bc*sc*i*
alias:          pci:v000019A2d00000211sv*sd*bc*sc*i*
depends:        
vermagic:       2.6.32-279.el6.x86_64 SMP mod_unload modversions 
parm:           rss_on_mc:Enable RSS in multi-channel functions with the capability. Disabled by default. (ushort)
parm:           tx_prio:Create priority based TX queues. Disabled by default (uint)
parm:           num_vfs:Number of PCI VFs to initialize (uint)
parm:           rx_frag_size:Size of receive fragment buffer - 2048 (default), 4096 or 8192 (ushort)
parm:           gro:Enable or Disable GRO. Enabled by default (uint)
parm:           emi_canceller:Enable or Disable EMI Canceller. Disabled by default (uint)
[root@Ustor be2net-10.2.470.14]# modprobe be2net
[root@Ustor be2net-10.2.470.14]# ethtool eth2
Settings for eth2:
    Supported ports: [ FIBRE ]
    Supported link modes:   10000baseT/Full 
    Supports auto-negotiation: No
    Advertised link modes:  Not reported
    Advertised pause frame use: No
    Advertised auto-negotiation: No
    Speed: 10000Mb/s
    Duplex: Full
    Port: FIBRE
    PHYAD: 0
    Transceiver: external
    Auto-negotiation: off
    Supports Wake-on: g
    Wake-on: d
    Link detected: yes
[root@Ustor be2net-10.2.470.14]# ethtool -i eth2
driver: be2net
version: 4.1.307r
firmware-version: 10.0.803.19
bus-info: 0000:02:00.0
[root@Ustor be2net-10.2.470.14]# reboot

Broadcast message from root@Ustor
    (/dev/pts/1) at 15:50 ...
[dennis@localhost ~]$ ssh root@172.16.130.158
root@172.16.130.158&apos;s password: 
Last login: Wed Dec 31 09:32:07 2014 from 172.16.50.39
[root@Ustor ~]# 
[root@Ustor ~]# ethtool -i eth2
driver: be2net
version: 10.2.470.14
firmware-version: 10.0.803.19
bus-info: 0000:02:00.0
[root@Ustor ~]# 
</code></pre></li>
</ul>
<p>重新使用iometer测试看看，是否换了驱动性能有所提升<br>10G网络使用率为65%，速度达到780MB/s左右, 网络速度曲线还算平整  </p>
<p>把驱动还原为旧的版本，在测试一下，如果速度又是100MB/s左右，说明确实是驱动问题。  </p>
<p>经过测试，速度确实又回到100MB/s左右了，看来是驱动问题了。  </p>
<h4 id="关于Emulex万兆网卡测试，性能比较低-只有约100MB-s"><a href="#关于Emulex万兆网卡测试，性能比较低-只有约100MB-s" class="headerlink" title="关于Emulex万兆网卡测试，性能比较低(只有约100MB/s)"></a>关于Emulex万兆网卡测试，性能比较低(只有约100MB/s)</h4><ol>
<li>硬RAID，10块磁盘建raid5，建iscsi卷</li>
<li>windows使用iometer，1M;0%Read;0%Random</li>
<li>网卡驱动be2net从4.1.307r升级到10.2.470.14</li>
</ol>
<p>经检查测试，更新存储机器(172.16.130.158)的驱动版本(网卡驱动be2net从 4.1.307r升级到10.2.470.14) 后</p>
<p>使用iometer(1M;0%Read;0%Random)测试，速度从100MB/s左右提升到780MB/s左右</p>
<p>看起来原系统的Emulex万兆网卡驱动有问题，升级就好了.</p>
<p>驱动下载地址:</p>
<ul>
<li><p><a href="http://www.emulex.cn/downloads/emulex/drivers/linux/rhel-6-centos-6/drivers/" target="_blank" rel="external">http://www.emulex.cn/downloads/emulex/drivers/linux/rhel-6-centos-6/drivers/</a></p>
</li>
<li><p><code>wget http://www-dl.emulex.com/support/elx/rt10.2.9/ga/Linux/driver-source/be2net-10.2.470.14-1.src.rpm</code></p>
</li>
</ul>
<h4 id="总结-很多时候，复杂问题的背后隐藏的是简单的解决方法"><a href="#总结-很多时候，复杂问题的背后隐藏的是简单的解决方法" class="headerlink" title="总结: 很多时候，复杂问题的背后隐藏的是简单的解决方法"></a>总结: 很多时候，复杂问题的背后隐藏的是简单的解决方法</h4>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/12/31/checking-speed-of-network/" data-id="ciqqpe1s700btnmpv2fghintz" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/network/">network</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-network-analyze-with-wireshark" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/12/26/network-analyze-with-wireshark/" class="article-date">
  <time datetime="2014-12-25T16:00:00.000Z" itemprop="datePublished">2014-12-26</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/tools/">tools</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/12/26/network-analyze-with-wireshark/">network analyze with wireshark</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h4 id="Filter"><a href="#Filter" class="headerlink" title="Filter"></a>Filter</h4><p>1.过滤IP，如来源IP或者目标IP等于某个IP</p>
<pre><code>例子:
ip.src eq 192.168.1.107 or ip.dst eq 192.168.1.107
或者
ip.addr eq 192.168.1.107 // 都能显示来源IP和目标IP
</code></pre><p>2.过滤端口</p>
<pre><code>例子:
tcp.port eq 80 // 不管端口是来源的还是目标的都显示
tcp.port == 80
tcp.port eq 2722
tcp.port eq 80 or udp.port eq 80
tcp.dstport == 80 // 只显tcp协议的目标端口80
tcp.srcport == 80 // 只显tcp协议的来源端口80
udp.port eq 15000
过滤端口范围
tcp.port &gt;= 1 and tcp.port &lt;= 80
</code></pre><p>3.过滤协议</p>
<pre><code>例子:
tcp
udp
arp
icmp
http
smtp
ftp
dns
msnms
ip
ssl
oicq
bootp
等等
排除arp包，如!arp  或者  not arp
</code></pre><p>4.过滤MAC</p>
<pre><code>太以网头过滤
eth.dst == A0:00:00:04:C5:84 // 过滤目标mac
eth.src eq A0:00:00:04:C5:84 // 过滤来源mac
eth.dst==A0:00:00:04:C5:84
eth.dst==A0-00-00-04-C5-84
eth.addr eq A0:00:00:04:C5:84 // 过滤来源MAC和目标MAC都等于A0:00:00:04:C5:84的
less than 小于 &lt; lt
小于等于 le
等于 eq
大于 gt
大于等于 ge
不等 ne
</code></pre><p>5.包长度过滤</p>
<pre><code>例子:
udp.length == 26 这个长度是指udp本身固定长度8加上udp下面那块数据包之和
tcp.len &gt;= 7  指的是ip数据包(tcp下面那块数据),不包括tcp本身
ip.len == 94 除了以太网头固定长度14,其它都算是ip.len,即从ip本身到最后
frame.len == 119 整个数据包长度,从eth开始到最后
eth —&gt; ip or arp —&gt; tcp or udp —&gt; data
</code></pre><p>6.http模式过滤</p>
<pre><code>例子:
http.request.method == GET
http.request.method == POST
http.request.uri == /img/logo-edu.gif
http contains GET
http contains HTTP/1.
// GET包
http.request.method == GET &amp;&amp; http contains Host:
http.request.method == GET &amp;&amp; http contains User-Agent:
// POST包
http.request.method == POST &amp;&amp; http contains Host:
http.request.method == POST &amp;&amp; http contains User-Agent:
// 响应包
http contains HTTP/1.1 200 OK &amp;&amp; http contains Content-Type:
http contains HTTP/1.0 200 OK &amp;&amp; http contains Content-Type:
一定包含如下
Content-Type:
</code></pre><p>7.TCP参数过滤</p>
<pre><code>tcp.flags 显示包含TCP标志的封包。
tcp.flags.syn == 0×02    显示包含TCP SYN标志的封包。
tcp.window_size == 0 &amp;&amp; tcp.flags.reset != 1
</code></pre><p>8.过滤内容</p>
<pre><code>tcp[20]表示从20开始，取1个字符
tcp[20:]表示从20开始，取1个字符以上
tcp[20:8]表示从20开始，取8个字符
tcp[offset,n]
udp[8:3]==81:60:03 // 偏移8个bytes,再取3个数，是否与==后面的数据相等？
udp[8:1]==32  如果我猜的没有错的话，应该是udp[offset:截取个数]=nValue
eth.addr[0:3]==00:06:5B

例子:
判断upd下面那块数据包前三个是否等于0×20 0×21 0×22
我们都知道udp固定长度为8
udp[8:3]==20:21:22
判断tcp那块数据包前三个是否等于0×20 0×21 0×22
tcp一般情况下，长度为20,但也有不是20的时候
tcp[8:3]==20:21:22
如果想得到最准确的，应该先知道tcp长度
matches(匹配)和contains(包含某字符串)语法
ip.src==192.168.1.107 and udp[8:5] matches x02x12x21x00x22
ip.src==192.168.1.107 and udp contains 02:12:21:00:22
ip.src==192.168.1.107 and tcp contains GET
udp contains 7c:7c:7d:7d 匹配payload中含有0x7c7c7d7d的UDP数据包，不一定是从第一字节匹配。

例子:
得到本地qq登陆数据包(判断条件是第一个包==0×02,第四和第五个包等于0x00x22,最后一个包等于0×03)
0×02 xx xx 0×00 0×22 … 0×03
正确
oicq and udp[8:] matches ^x02[x00-xff][x00-xff]x00x22[x00-xff]+x03$
oicq and udp[8:] matches ^x02[x00-xff]{2}x00x22[x00-xff]+x03$ // 登陆包
oicq and (udp[8:] matches ^x02[x00-xff]{2}x03$ or tcp[8:] matches ^x02[x00-xff]{2}x03$)
oicq and (udp[8:] matches ^x02[x00-xff]{2}x00x22[x00-xff]+x03$ or tcp[20:] matches ^x02[x00-xff]{2}x00x22[x00-xff]+x03$)
不单单是00:22才有QQ号码,其它的包也有,要满足下面条件(tcp也有，但没有做):
oicq and udp[8:] matches ^x02[x00-xff]+x03$ and !(udp[11:2]==00:00) and !(udp[11:2]==00:80)
oicq and udp[8:] matches ^x02[x00-xff]+x03$ and !(udp[11:2]==00:00) and !(udp[15:4]==00:00:00:00)
说明:
udp[15:4]==00:00:00:00 表示QQ号码为空
udp[11:2]==00:00 表示命令编号为00:00
udp[11:2]==00:80 表示命令编号为00:80
当命令编号为00:80时，QQ号码为00:00:00:00
得到msn登陆成功账号(判断条件是USR 7 OK ,即前三个等于USR，再通过两个0×20，就到OK,OK后面是一个字符0×20,后面就是mail了)
USR xx OK mail@hotmail.com
正确
msnms and tcp and ip.addr==192.168.1.107 and tcp[20:] matches ^USRx20[x30-x39]+x20OKx20[x00-xff]+
</code></pre><p>9.dns模式过滤</p>
<p>10.DHCP</p>
<pre><code>以寻找伪造DHCP服务器为例，介绍Wireshark的用法。在显示过滤器中加入过滤规则，
显示所有非来自DHCP服务器并且bootp.type==0×02（Offer/Ack）的信息：
bootp.type==0×02 and not ip.src==192.168.1.1
</code></pre><p>11.msn</p>
<pre><code>msnms &amp;&amp; tcp[23:1] == 20 // 第四个是0×20的msn数据包
msnms &amp;&amp; tcp[20:1] &gt;= 41 &amp;&amp; tcp[20:1] &lt;= 5A &amp;&amp; tcp[21:1] &gt;= 41 &amp;&amp; tcp[21:1] &lt;= 5A &amp;&amp; tcp[22:1] &gt;= 41 &amp;&amp; tcp[22:1] &lt;= 5A
msnms &amp;&amp; tcp[20:3]==USR // 找到命令编码是USR的数据包
msnms &amp;&amp; tcp[20:3]==MSG // 找到命令编码是MSG的数据包
tcp.port == 1863 || tcp.port == 80
如何判断数据包是含有命令编码的MSN数据包?
1)端口为1863或者80,如:tcp.port == 1863 || tcp.port == 80
2)数据这段前三个是大写字母,如:
  tcp[20:1] &gt;= 41 &amp;&amp; tcp[20:1] &lt;= 5A &amp;&amp; tcp[21:1] &gt;= 41 &amp;&amp; tcp[21:1] &lt;= 5A &amp;&amp; tcp[22:1] &gt;= 41 &amp;&amp; tcp[22:1] &lt;= 5A
3)第四个为0×20,如:tcp[23:1] == 20
4)msn是属于TCP协议的,如tcp
</code></pre><h4 id="case-1"><a href="#case-1" class="headerlink" title="case 1"></a>case 1</h4><ul>
<li>1， “业务突然变慢，客户端（确定）和服务端（应该）都没有改动。”  </li>
</ul>
<p>[沛满]：如果怀疑是网络有问题，可以在业务慢的时候抓个500MB左右的网络包分析一下。<br>论坛可以上传的话我也可以帮忙分析。</p>
<ul>
<li>2，“在wireshark上，如何方便查一个tcp报对应的响应包（或响应包对应的原始包）。可<br>以手工根据sequence id和ack id来判断，但是wireshark提供方便的工具么？—-我们的业<br>务是在一个tcp长连接中发很多包。”</li>
</ul>
<p>[沛满]：这个要从基本原理讲起。TCP的工作方式不是逐个包发送的，而是一口气发出多个包<br>，从而提高传输效率。就像快递员会一次性携带很多包裹到我司前台一样，为的是减少消耗<br>在路上的往返时间。接收方收到这些包之后有两个选择，既可以每个包都确认（也就是你提<br>到的响应），也可以只确认最后一个来暗示所有包都收到了。举个例子，发送方发出了10个<br>包，编号1至10，且没有一个丢失的，那接收方既可以回复10个确认包，也可以只回复“ack 11”，<br>表示10以及10之前的所有包都收到了。当有丢包发生时，比如还是发送了10个包的情况，编号<br>也是1至10，但其中10号包丢失了，那接收方可以回复9个确认包，也可以只回复“ack 10”，<br>表示9以及9之前的包都收到了。</p>
<p>了解了这个原理，我们就知道在Wireshark上没有必要去对应每个ack和seq，因为大多数包即<br>便正常收到后也不会有ack。</p>
<ul>
<li>3，“有没有技巧可以方便的统计延时的情况，例如某时间段中，发包到收到ack的延时超过1s的数据包数量？”</li>
</ul>
<p>[沛满]：如果你只是想了解网络延时状况，那用ping最简单准确了，没有必要用Wireshark。<br>一般我们在乎的是应用层的延时，比如向一个服务器发送读请求，到收到读响应的时间差究竟<br>有多少。Wireshark上有提供这个功能，比如CIFS协议那就可以用“smb.time &gt; 1”来过滤出所<br>有超过一秒钟的延时的CIFS操作。如果是NFS，就用rpc.time（因为NFS是基于RPC的协议）。<br>HTTP也有http.time。</p>
<ul>
<li>4，“有没有技巧可以方便的统计丢包的情况，例如某时间段中，发出去的包没收到ack的有多少？”</li>
</ul>
<p>[沛满]：还是那句话，没有收到ack不一定是丢包了。如果是想看丢包重传的统计，那就<br>Analyze–&gt;Expert Info，然后看warnings or notes tab. 虽然要统计出结果很容易，不过<br>使用者需要理解tcp的基础知识才能解读这个结果，比如一个超时重传，导致的后果远远超过<br>一个快速重传。有启用SACK的时候，处理多个丢包的效率远高于没有启用SACK的……这个说起来太复杂了</p>
<h4 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h4><ul>
<li><a href="https://community.emc.com/thread/194901" target="_blank" rel="external">一站式学习Wireshark</a></li>
<li><a href="http://ninecmd.com/archives/97?replytocom=5" target="_blank" rel="external">WireShark 过滤语法</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/12/26/network-analyze-with-wireshark/" data-id="ciqqpe1s300bqnmpvoefd91c4" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/wireshark/">wireshark</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-how-to-implement-a-netdisk" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/12/12/how-to-implement-a-netdisk/" class="article-date">
  <time datetime="2014-12-11T16:00:00.000Z" itemprop="datePublished">2014-12-12</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/network/">network</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/12/12/how-to-implement-a-netdisk/">how to implement a netdisk</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Introduce"><a href="#Introduce" class="headerlink" title="Introduce"></a>Introduce</h3><h3 id="Function-list"><a href="#Function-list" class="headerlink" title="Function list"></a>Function list</h3><ol>
<li>File upload</li>
<li>File download</li>
<li>File list</li>
<li>File share</li>
<li>File classification</li>
<li>offline download</li>
</ol>
<h3 id="Architecture"><a href="#Architecture" class="headerlink" title="Architecture"></a>Architecture</h3><h3 id="Component-implement"><a href="#Component-implement" class="headerlink" title="Component implement"></a>Component implement</h3><h3 id="Features"><a href="#Features" class="headerlink" title="Features"></a>Features</h3><ol>
<li>File Reduplication</li>
</ol>
<h3 id="TODO"><a href="#TODO" class="headerlink" title="TODO"></a>TODO</h3><h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://open.qiniudn.com/my-road-of-cloud-storage.pdf" target="_blank" rel="external">我的存储之路</a></li>
<li><a href="http://www.zhihu.com/question/21591490" target="_blank" rel="external">网盘(云盘)的大空间是如何实现的?</a></li>
<li><a href="http://www.zte.com.cn/cn/products/cocloud/application/201208/t20120810_341895.html" target="_blank" rel="external">云盘 ZXCLOUD iSpace</a></li>
<li><a href="http://u.wems.net/index.html" target="_blank" rel="external">USpace</a></li>
<li><a href="http://wenku.baidu.com/link?url=TN-CFldzfea0lwlY-j6cnpgfzuJlA31AV2td16qFni_0BvIea-_izUSroc5sd-4xxRv2HriEQbcYsa8xb8XiHDxzlr4kMZPwkdaYe_vt63m" target="_blank" rel="external">USpace产品介绍</a></li>
<li><a href="http://501565246-qq-com.iteye.com/blog/1738716" target="_blank" rel="external">云存储之网盘浅析</a></li>
<li><a href="http://developer.baidu.com/wiki/index.php?title=docs/cplat/bcs/sdk" target="_blank" rel="external">百度云存储SDK及工具</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/12/12/how-to-implement-a-netdisk/" data-id="ciqqpe1s000bnnmpv000e15qm" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/netdisk/">netdisk</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-how-to-fix-nic-name-confusion" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/12/08/how-to-fix-nic-name-confusion/" class="article-date">
  <time datetime="2014-12-07T16:00:00.000Z" itemprop="datePublished">2014-12-08</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/network/">network</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/12/08/how-to-fix-nic-name-confusion/">how to fix NIC name confusion</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h4 id="Description"><a href="#Description" class="headerlink" title="Description"></a>Description</h4><p>list some text from command <code>dmesg</code>:  </p>
<pre><code>792 igb 0000:02:00.0: Intel(R) Gigabit Ethernet Network Connection
793 igb 0000:02:00.0: eth0: (PCIe:2.5GT/s:Width x1)
794 igb 0000:02:00.0: eth0: MAC: 00:1e:67:58:cc:b8
795 igb 0000:02:00.0: eth0: PBA No: 009000-000
796 igb 0000:02:00.0: LRO is disabled
797 igb 0000:02:00.0: Using MSI-X interrupts. 1 rx queue(s), 1 tx queue(s)
798 igb 0000:03:00.0: PCI INT A -&gt; GSI 18 (level, low) -&gt; IRQ 18
799 igb 0000:03:00.0: setting latency timer to 64
800   alloc irq_desc for 32 on node -1
801   alloc kstat_irqs on node -1
802 igb 0000:03:00.0: irq 32 for MSI/MSI-X
803   alloc irq_desc for 33 on node -1
804   alloc kstat_irqs on node -1
805 igb 0000:03:00.0: irq 33 for MSI/MSI-X
806 igb 0000:03:00.0: Intel(R) Gigabit Ethernet Network Connection
807 igb 0000:03:00.0: eth1: (PCIe:2.5GT/s:Width x1)
808 igb 0000:03:00.0: eth1: MAC: 00:1e:67:58:cc:b9
809 igb 0000:03:00.0: eth1: PBA No: 009000-000
810 igb 0000:03:00.0: LRO is disabled
811 igb 0000:03:00.0: Using MSI-X interrupts. 1 rx queue(s), 1 tx queue(s)
812 udev: renamed network interface eth0 to eth2
813 udev: renamed network interface eth1 to eth3
</code></pre><p>we can see that, interface name is eth0 and eth1 at the begin, then udev rename them.  </p>
<p>why?</p>
<h4 id="Checking-and-fix"><a href="#Checking-and-fix" class="headerlink" title="Checking and fix"></a>Checking and fix</h4><p>check the rule of udev:</p>
<pre><code>[root@Ustor network]# cat /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM==&quot;net&quot;, ACTION==&quot;add&quot;, DRIVERS==&quot;?*&quot;, ATTR{address}==&quot;00:25:90:d7:be:b4&quot;, ATTR{type}==&quot;1&quot;, KERNEL==&quot;eth*&quot;, NAME=&quot;eth0&quot;
SUBSYSTEM==&quot;net&quot;, ACTION==&quot;add&quot;, DRIVERS==&quot;?*&quot;, ATTR{address}==&quot;00:25:90:d7:be:b5&quot;, ATTR{type}==&quot;1&quot;, KERNEL==&quot;eth*&quot;, NAME=&quot;eth1&quot;
</code></pre><p>check ip information:  </p>
<pre><code>[root@Ustor network]# ip addr
1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth2: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:1e:67:58:cc:b8 brd ff:ff:ff:ff:ff:ff
    inet 172.16.60.220/24 brd 172.16.60.255 scope global eth2
    inet6 fe80::21e:67ff:fe58:ccb8/64 scope link 
       valid_lft forever preferred_lft forever
3: eth3: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:1e:67:58:cc:b9 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::21e:67ff:fe58:ccb9/64 scope link 
       valid_lft forever preferred_lft forever
</code></pre><p>we found that, the mac address from udev rules and <code>ip addr</code> were difference.  </p>
<p>Because udev had defined which NIC used eth0 and eth1, the new NIC(new mac address)<br>should used new interface name(here, using eth2 and eth3).</p>
<p>BTW, I ask the workmate what he had done before this problem occur, he said this<br>os was installed on another board before. That was the problem, the NIC changed,<br>but os not update, so it maded the interface name changed.</p>
<p>Fixed:  </p>
<ol>
<li>update mac address to /etc/udev/rules.d/70-persistent-net.rules.mb2  </li>
<li>reboot  </li>
</ol>
<h4 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h4>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/12/08/how-to-fix-nic-name-confusion/" data-id="ciqqpe1rx00bjnmpv1m77s7qk" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/linux/">linux</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/network/">network</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-ssd-cache-and-implementation" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/12/04/ssd-cache-and-implementation/" class="article-date">
  <time datetime="2014-12-03T16:00:00.000Z" itemprop="datePublished">2014-12-04</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/storage/">storage</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/12/04/ssd-cache-and-implementation/">ssd cache and implementation</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h4 id="Introduce"><a href="#Introduce" class="headerlink" title="Introduce"></a>Introduce</h4><ul>
<li><p>SSD缓存技术</p>
<ul>
<li>SSD的特性是读速高于写，因此在无盘领域应用SSD时多用作读缓存来使用，SSD缓存源自<br>PXD无盘的SSD二级缓存技术。这里的二级缓存不是指CPU的二级CACHE，而是指应用于无<br>盘架构的第二级读缓存功能。 </li>
<li><a href="http://baike.baidu.com/view/3967982.htm" target="_blank" rel="external">http://baike.baidu.com/view/3967982.htm</a></li>
<li><a href="http://www.searchstorage.com.cn/showcontent_66616.htm" target="_blank" rel="external">http://www.searchstorage.com.cn/showcontent_66616.htm</a></li>
</ul>
</li>
<li><p>快速块设备为较慢的块设备提供缓存</p>
<ul>
<li>Red Hat Enterprise Linux 7.0 中引进让快速块设备作为较慢块设备的缓存的功能作为<br>技术预览。这个功能可让 PCIe SSD 设备作为直接附加存储（DAS）或者存储局域网（SAN）<br>存储的缓存使用，以便提高文件系统性能</li>
<li><a href="https://access.redhat.com/documentation/zh-CN/Red_Hat_Enterprise_Linux/7/html/7.0_Release_Notes/chap-storage.html" target="_blank" rel="external">Reference</a></li>
</ul>
</li>
</ul>
<h4 id="Facebook-flashcache"><a href="#Facebook-flashcache" class="headerlink" title="Facebook flashcache"></a>Facebook flashcache</h4><p>Flashcache是Facebook技术团队的一个开源项目，最初是为加速MySQL设计。Flashcache通过<br>在文件系统（VFS）和设备驱动之间新增了一次缓存层，来实现对热门数据的缓存。</p>
<p>Flashcache在内核的层次：<br>VFS -&gt; Block层 -&gt; DM层 -&gt; flashcache -&gt; DeviceDriver -&gt; Disk</p>
<p>Flashcache最初的实现是write backup机制cache，后来又加入了write through和write around机制</p>
<pre><code>write backup: 先写入到cahce，然后cache中的脏块会由后台定期刷到持久存储。
write through: 同步写入到cache和持久存储。
write around: 只写入到持久存储。
</code></pre><p>参考:   </p>
<ul>
<li><a href="http://blog.chinaunix.net/uid-26950862-id-3948198.html" target="_blank" rel="external">Flashcache初探</a>  </li>
<li><a href="http://oldblog.donghao.org/2012/12/flashcacheoaiaoippt.html" target="_blank" rel="external">flashcache原理及改造（PPT）</a>  </li>
<li><a href="http://wenku.baidu.com/view/4c37447131b765ce0508142b?refer=&amp;clickSort=download" target="_blank" rel="external">flashcache原理及改造</a>  </li>
</ul>
<h4 id="What-skills-need-to-master"><a href="#What-skills-need-to-master" class="headerlink" title="What skills need to master"></a>What skills need to master</h4><h4 id="Implementation"><a href="#Implementation" class="headerlink" title="Implementation"></a>Implementation</h4><h4 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h4><ul>
<li><a href="http://blog.csdn.net/column/details/flashcache.html" target="_blank" rel="external">linux内核源码阅读之facebook硬盘加速利器flashcache</a></li>
<li><a href="http://bbs.chinaunix.net/forum.php?mod=viewthread&amp;tid=1917560&amp;page=1#pid13842158" target="_blank" rel="external">发几个自己做的关于内核IO方面的ppt</a></li>
<li><a href="https://github.com/facebook/flashcache/" target="_blank" rel="external">flashcache</a>  </li>
<li><a href="http://www.haiyun.me/archives/centos-flashcache.html" target="_blank" rel="external">Centos安装Flashcache使用SSD缓存</a>  </li>
<li><a href="http://blog.csdn.net/kidd_3/article/details/6984822" target="_blank" rel="external">flashcache的实现与分析</a>  </li>
<li><a href="https://awk.so/patents/CN103744624A?cl=zh" target="_blank" rel="external">一种实现存储系统ssd缓存数据选择性升级的系统架构</a>  </li>
<li><a href="http://www.csdn.net/article/2013-10-31/2817357-facebook-flashcache-2010-2013" target="_blank" rel="external">命中率80%，磁盘I/O减半，Flashcache的发展史</a>  </li>
<li><a href="http://cdn.oreillystatic.com/en/assets/1/event/45/Flashcache%20Presentation.pdf" target="_blank" rel="external">FlashCache at Facebook</a>  </li>
<li><a href="http://blog.chinaunix.net/uid-26950862-id-3948198.html" target="_blank" rel="external">Flashcache初探</a>  </li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/12/04/ssd-cache-and-implementation/" data-id="ciqqpe1ru00bfnmpvqgmyoptp" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/cache/">cache</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/linux/">linux</a></li></ul>

    </footer>
  </div>
  
</article>


  


  <nav id="page-nav">
    <a class="extend prev" rel="prev" href="/page/4/">&laquo; __('prev')</a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/3/">3</a><a class="page-number" href="/page/4/">4</a><span class="page-number current">5</span><a class="page-number" href="/page/6/">6</a><a class="page-number" href="/page/7/">7</a><span class="space">&hellip;</span><a class="page-number" href="/page/18/">18</a><a class="extend next" rel="next" href="/page/6/">__('next') &raquo;</a>
  </nav>
</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Catégories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/blog/">blog</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/database/">database</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/english/">english</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/kernel/">kernel</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/language/">language</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/linux/">linux</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/math/">math</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/network/">network</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/others/">others</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/person/">person</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/program/">program</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/source/">source</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/storage/">storage</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/tools/">tools</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/windows/">windows</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Mot-clés</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/FAQ/">FAQ</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/IRC/">IRC</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Translation/">Translation</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/android/">android</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/api/">api</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/assembly/">assembly</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/awk/">awk</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/batch/">batch</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/blog/">blog</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/book/">book</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/c/">c</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/c/">c++</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/cache/">cache</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/crash/">crash</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/database/">database</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/debug/">debug</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/dot/">dot</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/driver/">driver</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/emacs/">emacs</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/exploit/">exploit</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/file-system/">file system</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/filesystem/">filesystem</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/flowchart/">flowchart</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/gcc/">gcc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/git/">git</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/google/">google</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/graphviz/">graphviz</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hexo/">hexo</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hosts/">hosts</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/iscsi/">iscsi</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/java/">java</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/javascript/">javascript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/job/">job</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/json/">json</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/kernel/">kernel</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linux/">linux</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lisp/">lisp</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lua/">lua</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/makefile/">makefile</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/malloc/">malloc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/math/">math</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/maxima/">maxima</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/memory/">memory</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/memory-overflow/">memory overflow</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mtrace/">mtrace</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/netdisk/">netdisk</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/network/">network</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/others/">others</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/pandoc/">pandoc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/performance/">performance</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/person/">person</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/protobuf/">protobuf</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/python/">python</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/rsync/">rsync</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sed/">sed</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/shell/">shell</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/skype/">skype</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sms/">sms</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/source/">source</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ssh/">ssh</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/stack/">stack</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/storage/">storage</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/study/">study</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/svn/">svn</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sync/">sync</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/test/">test</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/time/">time</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/tools/">tools</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/valgrind/">valgrind</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vi/">vi</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vim/">vim</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/virtual/">virtual</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wget/">wget</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/windows/">windows</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wireshark/">wireshark</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/write/">write</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/xml/">xml</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Nuage de mot-clés</h3>
    <div class="widget tagcloud">
      <a href="/tags/FAQ/" style="font-size: 10px;">FAQ</a> <a href="/tags/IRC/" style="font-size: 10px;">IRC</a> <a href="/tags/Translation/" style="font-size: 13px;">Translation</a> <a href="/tags/android/" style="font-size: 10px;">android</a> <a href="/tags/api/" style="font-size: 10px;">api</a> <a href="/tags/assembly/" style="font-size: 10px;">assembly</a> <a href="/tags/awk/" style="font-size: 11px;">awk</a> <a href="/tags/batch/" style="font-size: 14px;">batch</a> <a href="/tags/blog/" style="font-size: 10px;">blog</a> <a href="/tags/book/" style="font-size: 10px;">book</a> <a href="/tags/c/" style="font-size: 16px;">c</a> <a href="/tags/c/" style="font-size: 19px;">c++</a> <a href="/tags/cache/" style="font-size: 10px;">cache</a> <a href="/tags/crash/" style="font-size: 10px;">crash</a> <a href="/tags/database/" style="font-size: 17px;">database</a> <a href="/tags/debug/" style="font-size: 12px;">debug</a> <a href="/tags/dot/" style="font-size: 10px;">dot</a> <a href="/tags/driver/" style="font-size: 10px;">driver</a> <a href="/tags/emacs/" style="font-size: 11px;">emacs</a> <a href="/tags/exploit/" style="font-size: 10px;">exploit</a> <a href="/tags/file-system/" style="font-size: 10px;">file system</a> <a href="/tags/filesystem/" style="font-size: 12px;">filesystem</a> <a href="/tags/flowchart/" style="font-size: 10px;">flowchart</a> <a href="/tags/gcc/" style="font-size: 10px;">gcc</a> <a href="/tags/git/" style="font-size: 12px;">git</a> <a href="/tags/google/" style="font-size: 11px;">google</a> <a href="/tags/graphviz/" style="font-size: 11px;">graphviz</a> <a href="/tags/hexo/" style="font-size: 10px;">hexo</a> <a href="/tags/hosts/" style="font-size: 10px;">hosts</a> <a href="/tags/iscsi/" style="font-size: 14px;">iscsi</a> <a href="/tags/java/" style="font-size: 10px;">java</a> <a href="/tags/javascript/" style="font-size: 10px;">javascript</a> <a href="/tags/job/" style="font-size: 10px;">job</a> <a href="/tags/json/" style="font-size: 10px;">json</a> <a href="/tags/kernel/" style="font-size: 14px;">kernel</a> <a href="/tags/linux/" style="font-size: 14px;">linux</a> <a href="/tags/lisp/" style="font-size: 10px;">lisp</a> <a href="/tags/lua/" style="font-size: 10px;">lua</a> <a href="/tags/makefile/" style="font-size: 10px;">makefile</a> <a href="/tags/malloc/" style="font-size: 10px;">malloc</a> <a href="/tags/math/" style="font-size: 11px;">math</a> <a href="/tags/maxima/" style="font-size: 10px;">maxima</a> <a href="/tags/memory/" style="font-size: 11px;">memory</a> <a href="/tags/memory-overflow/" style="font-size: 10px;">memory overflow</a> <a href="/tags/mtrace/" style="font-size: 10px;">mtrace</a> <a href="/tags/netdisk/" style="font-size: 10px;">netdisk</a> <a href="/tags/network/" style="font-size: 20px;">network</a> <a href="/tags/others/" style="font-size: 18px;">others</a> <a href="/tags/pandoc/" style="font-size: 10px;">pandoc</a> <a href="/tags/performance/" style="font-size: 16px;">performance</a> <a href="/tags/person/" style="font-size: 11px;">person</a> <a href="/tags/protobuf/" style="font-size: 11px;">protobuf</a> <a href="/tags/python/" style="font-size: 10px;">python</a> <a href="/tags/rsync/" style="font-size: 10px;">rsync</a> <a href="/tags/sed/" style="font-size: 11px;">sed</a> <a href="/tags/shell/" style="font-size: 15px;">shell</a> <a href="/tags/skype/" style="font-size: 11px;">skype</a> <a href="/tags/sms/" style="font-size: 10px;">sms</a> <a href="/tags/source/" style="font-size: 11px;">source</a> <a href="/tags/ssh/" style="font-size: 10px;">ssh</a> <a href="/tags/stack/" style="font-size: 10px;">stack</a> <a href="/tags/storage/" style="font-size: 15px;">storage</a> <a href="/tags/study/" style="font-size: 10px;">study</a> <a href="/tags/svn/" style="font-size: 11px;">svn</a> <a href="/tags/sync/" style="font-size: 10px;">sync</a> <a href="/tags/test/" style="font-size: 11px;">test</a> <a href="/tags/time/" style="font-size: 10px;">time</a> <a href="/tags/tools/" style="font-size: 16px;">tools</a> <a href="/tags/valgrind/" style="font-size: 10px;">valgrind</a> <a href="/tags/vi/" style="font-size: 10px;">vi</a> <a href="/tags/vim/" style="font-size: 14px;">vim</a> <a href="/tags/virtual/" style="font-size: 11px;">virtual</a> <a href="/tags/wget/" style="font-size: 10px;">wget</a> <a href="/tags/windows/" style="font-size: 11px;">windows</a> <a href="/tags/wireshark/" style="font-size: 10px;">wireshark</a> <a href="/tags/write/" style="font-size: 13px;">write</a> <a href="/tags/xml/" style="font-size: 10px;">xml</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/07/">July 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/04/">April 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/03/">March 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/02/">February 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/01/">January 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/11/">November 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/10/">October 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/09/">September 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/08/">August 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/07/">July 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/06/">June 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/03/">March 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/02/">February 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/01/">January 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/12/">December 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/11/">November 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/09/">September 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/08/">August 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/07/">July 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/06/">June 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/05/">May 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/04/">April 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/03/">March 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/11/">November 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/">October 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/09/">September 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/08/">August 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/07/">July 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/">June 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/05/">May 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/04/">April 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/03/">March 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/02/">February 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/01/">January 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/12/">December 2012</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/09/">September 2012</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Articles récents</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2016/07/17/how-to-implement-malloc/">如何实现一个malloc</a>
          </li>
        
          <li>
            <a href="/2016/07/17/study-grep-more/">grep工作原理</a>
          </li>
        
          <li>
            <a href="/2016/07/17/2016-04-13-malloc/">malloc</a>
          </li>
        
          <li>
            <a href="/2016/04/27/include-what-you-use/">使用IWYU整理头文件引用</a>
          </li>
        
          <li>
            <a href="/2016/04/24/understand-gcc-assembly-output/">understand gcc assembly output</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2016 Matrix207<br>
      Propulsé by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>

  </div>
</body>
</html>